Event Bubbling

Event bubbling is a concept in web development where an event that is triggered on a element of the DOM (Document Object Model) will also trigger the same event on its parent elements all the way up to the top of the document hierarchy. This happens because events "bubble up" through the DOM from the target element to the parent elements.

In below example when you click on button then automaticly its parent element's click event will be fired. You can stop event bubbling by using stopPropagation method.

To know more about stopPropagation, Click here.

See the Pen Untitled by Nirbhay (@nirbhaysingh) on CodePen.

No comments :

Please Give Your Feedback