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
I don't know that this is the correct answer, but the click
event handler is called when the user clears the input using the X button.
$('input[type="search"]').click(function(event) {
// This code runs anytime a user clicks on the input,
// including when they clear it using the X button.
})
No, it's not possible. This UI interaction is some goodness that webkit implements, but is not actually specced. See here. So even if it were possible--you can't expect this UI to be implemented in Gecko, for example, if and when they ever add type=search.
In my testing with MS Edge, it didn't fire any of these events. I tried input, change, click, and search and they weren't triggered when you click the X. I even tried directly setting input.onchange, input.onclick, etc - still nothing.
The only events that seemed to fire were mousedown and mouseup, but the input's value hadn't been cleared yet so I had to use a setTimeout after detecting the event.
I suppose u want to capture event when cross button is clicked Here is one solution I found I seems to be working fine(Without setTimeout())
$('id').bind('input propertychange', function() {
if (this.value == ""){
doStuff()
$input.trigger("cleared");
}});
Hope this helps!