Reputation: 15889
This code works when pressing enter on a PC keyboard if (event.keyCode == 13)
but this doesn't work on mobile phone's "Go" button. What is the keyCode that works for both Enter
and Go
key?
Upvotes: 0
Views: 1903
Reputation: 364
I was able to find this documentation for the Android keyboard: http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_ENTER
I don't know if those codes are consistent with what is passed to the web browser from the keyboard.
My recommendation would be to output the keycodes to a block of text as you enter them, then you could just test it out manually.
Where you are testing for event.keyCode == 13
, add something that looks like this:
document.body.innerHTML += "new code: " + event.keyCode + "<br/>"
Then you can hit the "Go" key a few times and see what code it gives you.
Upvotes: 1