Reputation: 1429
i'm using jquery mobile with phoneGap for creating a application in android.
In HTML5 standards,
<input type='search' onsearch='searchHandler()'>
But the search event is not triggered ?
Is it because i'm using in mobile.
Is there any other way to use that ?
Upvotes: 1
Views: 3751
Reputation: 76003
You can bind to the change
event to make sure you capture the search string after the user is done typing it:
$('input[type="search"]').on('change', function (event) {
//the user has changed the value and de-focused the element or submitted the search
});
Here is a demo: http://jsfiddle.net/w9Bdg/1/
Note that .on()
is new as of jQuery 1.7 and if you are using an older version it's the same in this case as .bind()
.
Upvotes: 2