0

I am using JQuery Mobile to developing my own app for BlackBerry based on WebWorks(HTML5,CSS3,JS) tecknologies.

On my layout div i have 3 input elements. I am wont to detect BlackBerry enter key pressed in first input to focus on next input.

How i can check if hardware enter key(and other keys like "T","R","D") pressed using JQuery Mobile??

virtyaluk
  • 145
  • 1
  • 12

1 Answers1

0

There's nothing specific to jQuery Mobile for this. You just need to add an event listener on the input and listen to the appropriate keypress event. You can find a nice explanation for them here.

Here's some sample code to get you started (not tested, you might need to debug):

$('#firstInput').keypress(function(event) {
  if ( event.which === 13 ) {
     $('#secondInput').focus();
   }
);

In the event.which, the key code gets checked (13 is for enter). Other keys have different key codes. Be careful, I remember a bug on Blackberry that it wouldn't trigger the keypress event for backspace.

Be more specific about your problem if you need more details.

Alex Ciminian
  • 11,398
  • 15
  • 60
  • 94