bubbles Event Property
Definition and Usage
The bubbles event property returns a Boolean value that indicates whether or not the event is a bubbling event.
Event bubbling directs an event to its intended target, it works like this:
- A button is clicked and the event is directed to the button
- If an event handler is set for that object, the event is triggered
- If no event handler is set for that object, the event bubbles up (like a
bubble in water) to the objects parent
The event bubbles up from parent to parent until it is handled, or until it
reaches the document object.
The following example checks if the triggered event is a bubbling event:
Try it yourself »
<p onclick="myFunction(event)">Click this paragraph.
An alert box will tell if the
event is a bubbling event.</p>
Thank You For Helping Us!
Your message has been sent to W3Schools.