alex.mironov alex.mironov - 5 months ago 64
Android Question

JavaScript keypress event not raised on Android browser

I have created a simple code to handle

keypress
event:

var counter = 0;
$('input').on('keypress', function () {
$('div').text('key pressed ' + ++counter);
});


JSFiddle.

But keypress event handler is not raised on mobile browser (Android 4+, WindowsPhone 7.5+).
What could be the issue?

HDT HDT
Answer

Try keyup will help you

var counter = 0;        
$('input').on('keyup', function () {
    $('div').text('key up ' + ++counter);
});