bubbles Event Property

Example

Is it a bubbling event?

// true or false?
event.bubbles;
Try it Yourself »

Description

The bubbles event property returns true if an event is a bubbling event.

Otherwise it returns false.

The bubbles event property is read-only.

Event Bubbling

Event bubbling directs an event to its target. It works like this:

When an element (like a button) is clicked, an event is directed to the element.
If an event handler is set for the element, the event handler is triggered.
Then the event "bubbles up" to the elements parent.
If an event handler is set for the parent, this event handler is triggered.
The event continues to bubble, until it reaches the top (the document element).

Prevent Bubbling:

The stopPropagation() Method stops bubbling.


Prevent Default Action:

The preventDefault() Method cancels an event (the default action will not occur).


Syntax

event.bubbles

Technical Details

Return Value: A Boolean.
Returns true if the event is a bubbling event (it can bubble up through the DOM).
Otherwise it returns false.
DOM Version: DOM Level 2 Events.

Browser Support

event.bubbles is a DOM Level 2 (2001) feature.

It is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 9-11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.