keyup

onkeyup event in Safari on IOS7 from a bluetooth keyboard

心已入冬 提交于 2019-11-29 14:16:12
I have the following setup: Bluetooth scanner iPad Webpage with a textfield for scan input Usage: User focus textfield and scan barcode with bluetooth scanner Scanner adds ENTER (13) at the end of the scan Problem: On Safari in IOS7 there seems to be a change on how keyboard events are handled on bluetooth devices. The code ... window.onkeyup = function (e) { console.log(e.KeyboardEvent) } ... should return information about the key pressed. Instead i get ... keyCode: 0 keyIdentifier: "Unidentified" ... no matter which key I press. Same result booth form bluetooth scanner and bluetooth

Jquery keyup not working on Android

北城以北 提交于 2019-11-29 06:58:28
i didn't tested this code on iPhone but i'm sure (tested) it doesn't works on android mobiles: $('#search').live('keyup',function(key){ if(key.which == 13){ /*ANIMATE SEARCH*/ _key = $(this).val(); $("#wrapper").html(""); $('#wrapper').hide(0).load('results.html').fadeIn(800); $('#search-fade').val(_key).fadeIn(); } }); to explain better : i have a simple <input type="text" name="search" id="search"/> don't know why but this code doesn't works properly on android mobile phones any ideas? The System Restart $(document).on('keyup','#search', function() { // code }); or $(document).delegate('

jquery keyup function check if number

左心房为你撑大大i 提交于 2019-11-29 06:02:31
i am trying to create an input field where the user can only type in numbers. this function is already working almost fine for me: $('#p_first').keyup(function(event){ if(isNaN(String.fromCharCode(event.which))){ var value = $(this).val(); $(this).val(value.substr(0,value.length-1)); } }); but the problem is, whe the user holds the key with an character the function keyup is not triggering.... any ideas how i can forbid this? Try binding to the keypress event instead of keyup . It gets fired repeatedly when a key is held down. When the key pressed is not a number you can call preventDefault()

Jquery: filter input on keypress

和自甴很熟 提交于 2019-11-29 04:42:18
I have a text field, which will accept only the following characters: Allowed characters: [a-z 0-9 + # - .] This is the same filter SO does in the 'Tags' field, when you're asking a question. If the user types an invalid character, i want the current text field value to remain unchanged. I tried: $('#post_tags').keypress(function(event){ var char = String.fromCharCode(event.which) var txt = $(this).val() if (! txt.match(/[^A-Za-z0-9+#-\.]/)){ $(this).val(txt.replace(char, '')); } }) Why it doesn't work? Thanks! /[^A-Za-z0-9+#-\.]/ This negates the match of any one of those characters. To make

Execute JS code after pressing the spacebar

不羁岁月 提交于 2019-11-28 13:17:51
this is my code in JavaScript: var changeIdValue = function(id, value) { document.getElementById(id).style.height = value; }; document.getElementById ("balklongwaarde").addEventListener("click", function(){ changeIdValue("balklongwaarde", "60px")}); document.getElementById ("balklevensverwachting").addEventListener("click", function(){ changeIdValue("balklevensverwachting", "60px")}); document.getElementById ("balkhart").addEventListener("click", function(){ changeIdValue("balkhart", "60px")}); document.getElementById ("balklever").addEventListener("click", function(){ changeIdValue("balklever

Jquery keyup not working on Android

二次信任 提交于 2019-11-28 00:28:48
问题 i didn't tested this code on iPhone but i'm sure (tested) it doesn't works on android mobiles: $('#search').live('keyup',function(key){ if(key.which == 13){ /*ANIMATE SEARCH*/ _key = $(this).val(); $("#wrapper").html(""); $('#wrapper').hide(0).load('results.html').fadeIn(800); $('#search-fade').val(_key).fadeIn(); } }); to explain better : i have a simple <input type="text" name="search" id="search"/> don't know why but this code doesn't works properly on android mobile phones any ideas? 回答1:

Don't Animate X If Animation X Already Running (inside keyup)

爱⌒轻易说出口 提交于 2019-11-28 00:26:57
The way it's currently written causes the hide to fire over and over if msg.d starts returning 'false' from 'true' until enough time has passed for the animation to stop. Is there an isHiding or something? Thanks in advance! if(msg.d == "true") { if(!$("#addContactEmailError").is(":visible")) { $("#addContactEmailError").show('bounce'); } $("#addContactSubmitButton").attr("disabled", true); } else { if($("#addContactEmailError").is(":visible")) { $("#addContactEmailError").hide('slide', { direction: "up" }); } $("#addContactSubmitButton").attr("disabled", false); } Edit 1 This is all in a

What's the theory behind jQuery keypress, keydown, keyup black magic (on Macs)? [closed]

浪子不回头ぞ 提交于 2019-11-27 17:12:46
I am confused about the various behaviors of keypress , keydown , and keyup . It seems that I have missed an important piece of documentation, one that explains the subtleties and nuances of this trio. Could someone help me to figure out which document I need to read in order to more effectively use these events? In case you want details, see below. @o.v.: you asked me to show some code, but it's not really a specific problem in the code that I'm trying to solve. I'm trying to get a handle on the behaviors of these event handlers and asking someone who understands them to point me to a good

Execute JS code after pressing the spacebar

匆匆过客 提交于 2019-11-27 07:35:30
问题 this is my code in JavaScript: var changeIdValue = function(id, value) { document.getElementById(id).style.height = value; }; document.getElementById ("balklongwaarde").addEventListener("click", function(){ changeIdValue("balklongwaarde", "60px")}); document.getElementById ("balklevensverwachting").addEventListener("click", function(){ changeIdValue("balklevensverwachting", "60px")}); document.getElementById ("balkhart").addEventListener("click", function(){ changeIdValue("balkhart", "60px")}

jQuery: keyup event for mobile device

我只是一个虾纸丫 提交于 2019-11-27 05:25:54
I'm having a few issues getting a keyup event to fire on my iPhone, my code is as follows: var passwordArray = ["word", "test", "hello", "another", "here"]; var test = document.getElementById('enter-password'); test.addEventListener('keyup', function(e) { if (jQuery.inArray(this.value, passwordArray) != -1) { alert("THIS IS WORKING"); } else {} }); The idea being that as the user is typing into the #enter-password field, as and when they've matched a word in the passwordArray the alert will fire. This works on desktop, e.g. once you've entered word the function will fire straight away as soon