How to call iOS search button using javascript / Jquery?
I have searcharea where i used
<form><input name="search"/></form>
which allows and shows the search button on the iOS mobile keyboard.
Now my question is, how can I find this search button in the code so that I can add onclick = "(callFunction)", for example, how could I do it if I created the button myself. Any help or input is greatly appreciated, thanks!
+3
source to share
1 answer
I think you are using and type="search"
, so you can attach an event handler to the event search
, for example:
$('input[type=search]').on('search', function () {
// search logic
});
or
<input type="search" name="search" onsearch="OnSearch(this)"/>
Doc:
Occurs when the user presses the ENTER key or clicks the Erase Search button text '(x) in the input field: search field.
+1
source to share