In HTML5 there is a new input type, 'search'. On most browser it's just remain to a simple 'text' input, but for webkit based browsers, it adds a little cross to reset the input.
I'd like to be able to handle this, is there an event for that?
To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.
The onreset event occurs when a form is reset.
The reset() method resets the values of all elements in a form (same as clicking the Reset button). Tip: Use the submit() method to submit the form.
This mentions a comment from Ajaxian (WebKit HTML5 Search Inputs):
There are also some custom events too – such as ’search’ which fires when the user pauses typing (set ‘incremental’ to true).
When testing, I found that this 'search' event also gets called when the input is cleared (at least in the latest version of Safari).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With