alh alh - 1 year ago 34
jQuery Question

Stop propagation for all events

I am calling

on almost every event that I have for my current application. Is there any way to just stop the propagation for every event without having to explicitly call the method at the start of every function body?

Answer Source

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.