#Javascript #Tutorial #Hindi

Link for Complete JavaScript Tutorial in Hindi for Beginners: https://www.youtube.com/playlist?list=PLjpp5kBQLNTSvHo6Rp4Ky0X8x_MabmKye

Link for Complete HTML and CSS Tutorial in Hindi for Beginners: https://www.youtube.com/playlist?list=PLjpp5kBQLNTSdLVVjU_kea8J8lP24ZseT


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



Please subscribe to watch more videos like this: https://www.youtube.com/channel/UCWCGvAu1NDCldmLasELk62g?sub_confirmation=1



Join this channel to support Tech Gun:
https://www.youtube.com/channel/UCWCGvAu1NDCldmLasELk62g/join