Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any events available for the reset option for input search?

Tags:

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?

like image 500
Boris Guéry Avatar asked Mar 22 '10 13:03

Boris Guéry


People also ask

How do you reset input fields in HTML?

To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.

Which event can be generated when the user clicks a reset button?

The onreset event occurs when a form is reset.

How do I reset a form?

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.


1 Answers

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).

like image 62
Nick Wientge Avatar answered Sep 28 '22 01:09

Nick Wientge