I am trying to alert the key which was pressed. It is working on PC but returning "Unidentified" on mobile. Why is that?
$(document).on("keydown", function(e) {
alert(e.key);
});
I am trying to alert the key which was pressed. It is working on PC but returning "Unidentified" on mobile. Why is that?
$(document).on("keydown", function(e) {
alert(e.key);
});
This is a known bug in Chrome on Android. See this other question and the official bug report. I wish I had better news for you, but it looks like you can't rely on keyboard triggers in web apps on Android if you need to capture the individual key values.
What you need to do is catch the e.target.value:
$(document).on("keydown", function(e) {
var inputValue = e.target.value;
var lastLetter = inputValue.charAt(inputValue.length - 1);
alert('Letter: ' + lastLetter);
});