W3cubDocs

/DOM

Event.stopPropagation

Prevents further propagation of the current event in the capturing and bubbling phases.

Syntax

event.stopPropagation();

Example

See Example 5: Event Propagation in the Examples chapter for a more detailed example of this method and event propagation in the DOM.

Notes

See the DOM specification for the explanation of event flow. (The DOM Level 3 Events draft has an illustration.)

preventDefault is a complementary method that can be used to prevent the default action of the event from happening.

Specifications

Browser CompatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes Yes 9 Yes Yes
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes Yes Yes Yes ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation