Search⌘ K

Go farther with Events

Explore event propagation in the DOM and learn to control it by stopping propagation and preventing default behaviors in JavaScript. This lesson helps you handle events precisely by managing how they bubble up through the DOM and how to override default browser actions.

Event propagation

The DOM represents a web page as a hierarchy of nodes. Events triggered on a child node are going to get triggered on the parent node, then the parent node of the parent node, up until the root of the DOM (the document variable). This is called event propagation. To see propagation in action, use this HTML code to create a ...