Windows 8 introduced a real nice feature for textbox: the clear button.


By clicking on this button, you can simply empty the textbox.

But the question is: how can I handle the associated event?

In fact, as usual, it is pretty simple (when you have the solution!). You just have to handle the oninput event Sourire

This event is raised every time an input is produced for the textbox. For instance, this occurs when you enter some text, or you cut, delete (using the cross!), or paste content.


To handle the event, just add the following code:

document.getElementById("textFilter").oninput = function () {