I have defined keyboard events which is working good in desktop but for touch devices not getting the onscreen keyboard event. I need to capture if user is typing. I have used the following segment of code :
$('#id').keydown(function(e){
//some code here
});
$('#id').keyup(function(e){
//some code here
})
I want the code defined in keydown
and keyup
to trigger even for touch devices (both tablets and mobiles). Please suggest how to capture the onscreen keyboard event and make the above code to run.
The last answer on this page works: How can I get jquery .val() AFTER keypress event? -
Basically discard the "keyup" and change to "input", something like: $(document).delegate('#q', 'input', function(e) { etc }
Have you tried using key press instead of key down
Updated :
Due to android problems I now normally wrap my checks like this
Here is a small example using
Materialize
in order to test in touch devices.