The Event.cancelBubble property is a historical alias to Event.stopPropagation(). Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details. 

Syntax

event.cancelBubble = bool;
var bool = event.cancelBubble;

Example

elem.onclick = function(e) {
 // do cool things here
  e.cancelBubble = true;
}

Specifications

Specification Status Comment
DOM
The definition of 'cancelBubble' in that specification.
Living Standard  

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) [1] 53 (53)[2] (Yes) (Yes) [1] (Yes)
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) [1] (Yes) [1] 53 (53)[2] (Yes) (Yes) [1] (Yes)

[1] Starting with Chrome 58 and Opera 45, setting this property to false does nothing, as per spec discussion.

[2] Previous to Firefox 52, this property was defined on the UIEvent interface. See bug 1298970 for more details.

Document Tags and Contributors

 Contributors to this page: Sheppy, caseyjhol, jpmedley, chrisdavidmills, erikadoyle, cvrebert
 Last updated by: Sheppy,