Course contentsShow
← Web Development
Lesson 720 of 2,98213. DOM EventsFree lesson

Event Bubbling Phase

How events propagate upward from target element through ancestors during the bubbling phase.

What You'll Learn

You'll discover how a triggered event travels upward through the DOM tree from the target element to its ancestors, letting parent elements also respond to the event.

How Event Bubbling Works

When you click a button nested inside a <div> which is inside a <body>, you're not just clicking the button—you're also clicking the <div> and the <body>. Event bubbling describes how, after an event fires on the target element, it "bubbles up" through each parent element in the DOM tree, triggering any event listeners attached along the way.

The Journey Upward

After you've used addEventListener() to attach event handlers to elements, here's what happens during the bubbling phase:

  1. The event fires on the target element (the deepest element you actually interacted with)
  2. The event then propagates to the parent element
  3. Then to the parent's parent
  4. This continues all the way up to the document object

Each ancestor with an event listener for that event type gets a chance to respond.

Real-World Analogy

Think of dropping a stone in water. The initial splash happens at the impact point (target element), but ripples spread outward and upward through the water (parent elements). Each ripple is the event passing through another layer of the DOM tree.

Why This Matters

Bubbling lets you attach a single event listener to a parent element instead of many listeners to individual children—a powerful technique for handling dynamic content or lists with many items.

Key Takeaway: Events bubble upward from the target element through all ancestor elements, triggering any matching event listeners along the way, which enables efficient event delegation patterns.