1) What is Event bubbling in Javascript. Give Example
Event bubbling is the method of event propogation in which event travels from innermost element to the outermost parent element.
Like if we have below structure
<section onclick="alert('section')">
<div onclick="alert('div')">
<p onclick="alert('paragraph')">
This is paragraph
</p>
</div>
</section>
If click event of paragraph invoked it will call click handlers of all in below order
p>div>section
Event bubbling is also known as Event Propagation or Event Delegation
2) How can event bubbling can be stopped?
stopPropagation() method of javascript used for stopping event bubbling
For more such videos you can check my channel
Top comments (0)