Jquery — Action fires on any event [duplicate]

2020-04-02 09:40发布

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("");
});

1条回答
家丑人穷心不美
2楼-- · 2020-04-02 10:25
$('*').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?

查看更多
登录 后发表回答