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
  • 139,199
  • 49
  • 202
  • 242

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
  • 354,903
  • 100
  • 647
  • 710