The stopPropagation()
method of the Event
interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault()
method.
Syntax
event.stopPropagation();
Parameters
None.
Return value
undefined
.
Examples
See Example 5: Event Propagation in the Examples chapter for a more detailed example of this method and event propagation in the DOM.
Specifications
Specification | Status | Comment |
DOMThe definition of 'Event.stopPropagation()' in that specification. | Living Standard | |
DOM4The definition of 'Event.stopPropagation()' in that specification. | Obsolete | |
Document Object Model (DOM) Level 2 Events SpecificationThe definition of 'Event.stopPropagation()' in that specification. | Obsolete | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
stopPropagation
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support 9 |
Opera
Full support 7 |
Safari
Full support 1 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 10.1 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Legend
- Full support
- Full support
See also
- See the DOM specification for the explanation of event flow. The DOM Level 3 Events draft has an illustration.
Event.stopPropagation() by Mozilla Contributors is licensed under CC-BY-SA 2.5.