preventDefault vs stopPropagation Playground

Write a listener’s body on four real pages (a link, a form, a checkbox, a dropdown) and click: the board separates the browser’s default action from the…

Why it matters

Get them wrong and the form still reloads (no preventDefault), or click-outside, analytics and delegation die quietly (too much stopPropagation). Once you see them as two separate things, this whole class of bugs goes away.

The key idea

Two brakes that do not touch each other

Common mistakes

Try it in this playground