onKeyDown code not working on android mobile browsers
See original GitHub issueBelow code is not working properly on mobile browsers, the reason is event.keyCode or event.which is not returning proper value on mobile browser
onKeyDown: function (event) {
var owner = this, pps = owner.properties,
charCode = event.which || event.keyCode;
// hit backspace when last character is delimiter
if (charCode === 8 && Cleave.Util.isDelimiter(owner.element.value.slice(-1), pps.delimiter, pps.delimiters)) {
pps.backspace = true;
return;
}
pps.backspace = false;
},
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Keycode is always zero in Chrome for Android - Stack Overflow
I'm running Chrome 27.0.1453.90 on Android 4.1.2 Jelly Bean. The problem can be duplicated with something as simple as: alert(event.keyCode);.
Read more >my code not working on chrome mobile but all browser working
There certainly some issue with 'keypress' event on Android browser (i.e. chrome mobile). Try replacing it with 'keydown' event, ...
Read more >keydown and keyup events do not have proper keyCode (it's ...
These problems still seem to be plaguing browsers on Android devices. Keypress events are not firing at all, and keydown/up events are returning...
Read more >Hostlistener keydown or keypress not working on mobile ...
Hi people,. Im currently working on an angular application where we are trying to prevent people to put invalid characters into a text...
Read more >Issue 118639 in chromium: keydown and keyup events do not ...
http://code.google.com/p/chromium/issues/detail?id=118639 ... For android browser app, it sends the key code if I type a key, but it
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It worked using this hack:
Can anyone help how to write this code…
function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if ((charCode < 48 || charCode > 57)) return false; return true; };