JavaScript11 min read

JavaScript Event Bubbling and Capturing

Understand event bubbling and capturing. Learn how events propagate through DOM elements.

Alex Thompson
Dec 20, 2025
20.8k937

JavaScript Event Bubbling

Event Bubbling

Events bubble up from child to parent:

┌─────────────┐
│   Parent    │ ← Event reaches here
│  ┌────────┐ │
│  │ Child  │ │ ← Click happens here
│  └────────┘ │
└─────────────┘

stopPropagation()

button.addEventListener('click', (e) => {
  e.stopPropagation(); // Stop bubbling
});

Key Takeaway

Events bubble up the DOM tree. Use stopPropagation() to stop. Understanding bubbling is crucial for event handling.

#JavaScript#Events#Bubbling#DOM#Intermediate