2

When I click the little "X" in an input form field of type "time" I want to fire an event.

I tried the click event but it does not work. It seems like the "X" is an element above the input field. It triggers when clicking inside it somewhere else.

$( "input" ).click(function() {
  console.log( "Clear has been clicked" );
});

How can I fire an event on input "X" (clear)?

Jens Törnell
  • 23,180
  • 45
  • 124
  • 206

1 Answers1

3

Try with input event:

$( "input" ).on('input', function() {
  console.log( "Clear has been clicked" );
});
Jai
  • 74,255
  • 12
  • 74
  • 103