Hoa Hoang
Hoa Hoang

Reputation: 1242

Trigger enter event on Android keyboard Phonegap Application

I'm new to Android Phonegap. I'm using Phonegap cordova 3.3.0 to develop phonegap application. But I don't know how to trigger "enter" event on Android keyboard.

For example: when I touch on Input field, the keyboard appear, and I want to submit the form when press "Enter/go" button. Please tell me how to do it, or give me the reference link?

Thanks very much!

Android keyboard

Upvotes: 2

Views: 1815

Answers (1)

Amit Prajapati
Amit Prajapati

Reputation: 14315

Try this

$(document).keypress(function(e) {
 if(e.which == 13) {
    alert('You pressed enter!');
 }
});

Upvotes: 4

Related Questions