cancelBubble() Event Property
Example
Prevent any bubbling of the current event:
function func1(event) {
alert("DIV 1");
event.cancelBubble = true;
}
Try it Yourself »
Description
The cancelBubble()
method prevents the event-flow from bubbling up to parent elements.
Tip: To prevent both bubbling up to parent elements and capturing down to child elements,
use the stopPropagation()
method instead.
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
cancelBubble | Yes | 9.0 | Yes | Yes | Yes |
Syntax
event.cancelBubble = true|false
Parameters
None |
Technical Details
Return Value: | No return value |
---|---|
DOM Version: | DOM Level 3 Events |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.