JavaScript

What is event bubbling and capturing?

Medium
3
Added
Bubbling: Events propagate up from target. Capturing: Events trickle down to target (use capture: true).

Solution Code

JavaScript
element.addEventListener('click', handler, { capture: true });
Explanation
Capturing phase happens before bubbling phase. stopPropagation() stops both.

Guided Hints

What is event delegation?
Difference between stopPropagation and preventDefault