cancelBubble Event Attribute
Definition and Usage
cancelBubble
The attribute prevents the event from bubbling up to the parent element.
Tip:If you need to prevent the bubble from bubbling up to the parent element and capturing down to the child element, please use the stopPropagation() method instead.
Instance
Prevent the current event from bubbling:
function func1(event) { alert("DIV 1"); event.cancelBubble = true; {}
Syntax
event.cancelBubble = true|false
Parameters
None.
Technical Details
Return Value: | No Return Value |
---|---|
DOM Version: | DOM Level 3 Events |
Browser Support
The numbers in the table indicate the first browser version that fully supports the property.
Properties | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
cancelBubble | Support | 9.0 | Support | Support | Support |