When an event on a child element propagates up to its parents. A click on a button inside a div triggers the button's listener first, then the div's listener, up to the document.
What is event bubbling (Oyo question)?
More FAQs in Event Bubbling Interview Questions (Oyo)
Call e.stopPropagation() in the event handler. This prevents the event from propagating to parent elements. Other listeners on the same element still run.
stopPropagation prevents bubbling to parents but other listeners on the same element still run. stopImmediatePropagation prevents both bubbling and other listeners on the same element.
Capturing (top-down: document to target's parent), Target (event reaches the target), Bubbling (bottom-up: target to document). Default listeners run in the bubbling phase.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.