DataZombies
DataZombies

Reputation: 425

iOS Webapp - What keyboard key is pressed?

How can I, with JavaScript, determine if the Search or Done buttons on the iOS keyboard are being tapped?

Upvotes: 0

Views: 680

Answers (1)

DataZombies
DataZombies

Reputation: 425

To determine if a Search or Go key is pressed listen for a chr$(13) keypress.

$('#searchBox').bind('keypress', function (e) {
  if (e.which === 13) {
    //do something
  }
});

Upvotes: 1

Related Questions