The stopPropagation() method prevents further propagation of the current event in the capturing and bubbling phases. Same-element listeners still run. Learn how it differs from preventDefault() and stopImmediatePropagation()—with five examples and try-it labs.
01
Kind
Instance method
02
Returns
undefined
03
Params
None
04
Stops
Further path
05
Same el
Listeners OK
06
Status
Baseline widely
Fundamentals
Introduction
When you click a button inside a div, the event can travel: capture down the tree, then bubble back up. A parent listener often hears the same click—useful for delegation, annoying when the parent should not react.
Call event.stopPropagation() to stop that further travel. Other handlers on the same button still run. Links still navigate unless you also call preventDefault(). To skip remaining same-element listeners too, use stopImmediatePropagation().
💡
Beginner tip
“Stop propagation” = stop traveling to other elements. “Prevent default” = stop the browser’s built-in action. They solve different problems.
Concept
Understanding Event.stopPropagation()
An instance method that prevents further propagation of the current event in the capturing and bubbling phases.
No parameters — call event.stopPropagation().
Return value — none (undefined).
Stops further path — parents (bubble) or deeper nodes (if called during capture) do not receive it later.
Same-element listeners — still run (unlike stopImmediatePropagation).
Defaults unchanged — use preventDefault() to cancel navigation / submit / etc.
Baseline Widely available on MDN (since July 2015); also in Web Workers.
Foundation
📝 Syntax
JavaScript
stopPropagation()
Parameters
None.
Return value
None (undefined).
Typical pattern
JavaScript
child.addEventListener("click", (event) => {
event.stopPropagation();
// Parent click listeners will not hear this click
});
Compare
⚖️ stopPropagation() vs Related Ideas
Idea
Meaning
stopPropagation()
Stop further capture/bubble travel; same-element OK
stopImmediatePropagation()
Also skip remaining same-element listeners
preventDefault()
Cancel browser default action
cancelBubble
Deprecated; prefer stopPropagation()
eventPhase
Which stage you are in (capture / target / bubble)
Event.stopPropagation() is marked Baseline Widely available on MDN (since July 2015). Logos use the shared browser-image-sprite.png sprite from this project. It is also available in Web Workers.
✓ Baseline · Widely available
Event.stopPropagation()
Prevents further propagation in the capturing and bubbling phases; same-element listeners still run.
UniversalWidely available
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerSupported in legacy IE (prefer modern browsers)
Legacy
Event.stopPropagation()Excellent
Bottom line: Use stopPropagation to isolate nested UI clicks; pair with preventDefault when you also need to cancel defaults.
Wrap Up
Conclusion
Event.stopPropagation() stops further capture/bubble travel while letting other listeners on the current element finish. Reach for stopImmediatePropagation() when those must be skipped too, and preventDefault() when the browser default must go.
Prefer it over stopImmediate when same-element handlers should run
Call preventDefault separately when needed
Know whether you listen in bubble or capture
Prefer stopPropagation over deprecated cancelBubble
❌ Don’t
Expect it to cancel link navigation alone
Use it everywhere—delegation often wants bubbling
Confuse it with stopImmediatePropagation
Assume parents already ran in capture are undone
Fight document-level closers without a clear UX plan
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about stopPropagation()
Stop the path—not the default, not same-element leftovers.
5
Core concepts
🛑01
Stops
further path
API
🔁02
Same el
still runs
Local
🚫03
≠ default
use preventDefault
Pair
⚡04
< immediate
softer stop
Compare
🎯05
Baseline
since Jul 2015
Status
❓ Frequently Asked Questions
It prevents the current event from traveling further in the capturing and bubbling phases. Other listeners on the same element still run. It does not cancel the browser default action.
No. MDN marks Event.stopPropagation() as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
stopPropagation() still allows remaining listeners on the current element to run, then stops further travel. stopImmediatePropagation() also skips those remaining same-element listeners.
preventDefault() cancels the browser default (link navigation, form submit, and so on). stopPropagation() only affects which other elements hear the event.
It stops further propagation in both capturing and bubbling. Listeners that already ran are not undone. Calling it during capture prevents the event from continuing down (and later up) the tree.
Event.cancelBubble is a deprecated legacy flag related to stopping propagation. Prefer stopPropagation() in modern code.
Did you know?
Event delegation (one listener on a parent) depends on bubbling. Overusing stopPropagation() can break those patterns—prefer it for specific nested controls, not as a global habit.