Question

after reading some documentation I understand that Opera mini does not support key press events. I'm curious about one thing though: When entering text we use the phone's text input method, and end up by pressing "OK" one way or another. Is there any way (even browser specific) to emulate a keydown listener that would test for the 13 keyCode ?

I'm using the simplest method to catch the event (I know it's basic, it's for a super simple project)

<input type="text" id="query" onkeydown="if (event.keyCode == 13) document.getElementById('btnSearch').click()" />

Note: I'm using Opera mini 4.4 but I'll accept tricks for any version out of curiosity :)

edit: Something is definitely happening when the listener is present, Opera does some "processing" which means it's executing client code. The processing disappears if I remove the listener. Still, I can't get it to execute anything. It just processes and goes back to the top of the page

Thanks!

Was it helpful?

Solution

Keydown is unsupported DOM event in Opera Mini. It will be better to change your app using change event, but enter key do not fire change event. You can try document.createEvent and initKeyboardEvent methods, but IMHO for keydown it will not work also.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top