Favorites

DOM Event.stopPropagation() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Event.stopPropagation()
DOM Event MethodThis method is supported by all modern browsers.
Updated 28th November 2026

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

<div id="outer" style="padding:16px;background:#eef">Outer <button id="inner" type="button">Inner</button></div>
document.getElementById('outer').addEventListener('click', () => console.log('outer handler'));
document.getElementById('inner').addEventListener('click', e => {
  e.stopPropagation();
  console.log('inner handler (stops here)');
});
document.getElementById('inner').click();

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.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee