JavaScript Tutorial in Hindi for Beginners [Part 63] Event Bubbling & Event Capturing in JavaScript

Tech Gun
Youtube
Related Topic
:- Javascript Web Development

 In this video i will talk about Event Bubbling & Event Capturing in JavaScript. When you click the button, you’re clicking not only the button but also the button’s container, the div, and the whole webpage. Event flow explains the order in which events are received on the page from the element where the event occurs and propagated through the DOM tree. There are two main event models: event bubbling and event capturing. 1. Event bubbling In the event bubbling model, an event starts at the most specific element and then flows upward toward the least specific element (the document or even window). When you click the button, the click event occurs in the following order: button div with the id container body html document 2. Event capturing In the event capturing model, an event starts at the least specific element and flows downward toward the most specific element. When you click the button, the click event occurs in the following order: document html body div with the id container button.

Comments