11

Is there something in jquery where a function is triggered when any event is fired?

I'd like something like this:

$("*").anyEvent(function(){
  $("#error").html("");
});
Peter Olson
  • 131,160
  • 48
  • 197
  • 239

1 Answers1

22
$('*').on('blur change click dblclick error focus focusin focusout hover keydown keypress keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup resize scroll select submit', function(){
  $('#error').empty();
});

...but would you want to do this?

Matt Ball
  • 344,413
  • 96
  • 627
  • 693