Event Bubbling, Capturing and Propagation in JavaScript ? Frontend Interview Series

When working with events in JavaScript you have the option of using 'bubbling' or 'capturing' to define the order in which the event handlers fire off. In most cases, bubbling is default.

Typically you don't need to worry about capturing unless you need ultimate control over your event handlers. This concept is only relevant if you have a parent element and a child element which both have event listeners.

When using 'bubbling', events are fired off beginning with the child element and then go up to the parent.

In contrast, 'capturing' means that events are fired off from the parent first, and then down to the child element.

In this video I show you a simple example of how these two options differ along with Stop Propagation , Immediate Propagation & Prevent Default .

00:00 - Don't skip anything
Web design
Be the first to comment