jmilloy
jmilloy

Reputation: 8365

html5 search input events

What event is triggered when a user clicks the X in a search input field (in webkit browsers) to cancel the search or clear the text?

Information is available about restyling the button and other custom events, but not on using this button.

Upvotes: 8

Views: 7498

Answers (1)

jmilloy
jmilloy

Reputation: 8365

The onsearch event is triggered both when the search input is submitted and when the user clears the search.

<input type=search onsearch="javascript:alert('SEARCH: ' + this.value);" />

Upvotes: 13

Related Questions