Explain event bubbling and event capturing in javascript?
Answer / Sandeep Jaiswal
Event bubbling is the process by which an event cascades up through the DOM tree starting from the element that triggered the event, followed by its parent elements. Event capturing is the opposite, where events cascade down through the DOM tree from the root element to the element that triggered the event.n```javascriptndocument.body.addEventListener('click', function(event) {n console.log('Event captured');n}, true); // Capture phasen document.body.addEventListener('click', function(event) {n console.log('Event bubbled up');n}); // Bubble phasen```
| Is This Answer Correct ? | 0 Yes | 0 No |
20 Functions of Selenium with description and Examples.
Do you have to declare variables in javascript?
Why do you need javascript?
What does double mean in javascript?
What is a class in javascript?
Which software is used for javascript?
What is the use of spread operator?
Are javascript variables case sensitive?
How to redirect a page to another page in javascript?
How to add/remove properties to object dynamically in javascript?
What do mean by NULL in Javascript?
How to calculate fibonacci numbers in javascript?