Stop propagation for all events

前端 未结 4 1472
野性不改
野性不改 2021-01-08 00:38

I am calling e.stopPropagation() on almost every event that I have for my current application. Is there any way to just stop the propagation for every event wit

4条回答
  •  生来不讨喜
    2021-01-08 00:57

    You could bind all events (remove the ones you don't need):

    $('*').bind('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(event){
        event.stopPropagation();
    });
    

    Take a look at possible events at jQuery Docs

提交回复
热议问题