Normal keypress event does not give keyCode in android device. There has already been a big discussion on this.
If you want to capture the press of space bar
or special chars
, you can use textInput
event.
$('input').on('textInput', e => {
var keyCode = e.originalEvent.data.charCodeAt(0);
// keyCode is ASCII of character entered.
})
Note: textInput
does not get triggered on alphabets, number, backspace, enter and few other keys.