Stop propagation for all events

前端 未结 4 1476
野性不改
野性不改 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 01:03

    No it cannot be declared Globally

    The event.stopPropagation() method stops the bubbling of an event to parent elements, preventing any parent event handlers from being executed.

    For example, if there is a link with a click method attached inside of a DIV or FORM that also has a click method attached, it will prevent the DIV or FORM click method from firing.

    http://api.jquery.com/event.stopPropagation/

提交回复
热议问题