DOM Event.stopPropagation() Method
The stopPropagation() method stops an event from travelling further up (or down) the DOM tree, so listeners on parent elements don't receive it.
Description
The stopPropagation() method prevents the event from propagating any further through the capture and bubble phases, so ancestors' listeners don't run. Other listeners on the current element still run; stopImmediatePropagation() stops those too. It doesn't prevent the default action.
Use it sparingly: stopping events can break other code that relies on them, such as analytics or "click outside to close" handlers. Checking event.target in the parent is often a better solution.
Not every event propagates anyway: events such as focus, blur, mouseenter and load on images don't bubble, so there's nothing to stop. Calling it in a capturing listener stops the event before it reaches its target.
Syntax
event.stopPropagation()Return Value
None (undefined).
Example
Browser Support
The following information will show you the current browser support for the Event.stopPropagation() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





