Тёмный

Event Delegation, Event Bubbling, Event Capturing - JavaScript || Hindi || Coding Scenes 

Coding Scenes
Подписаться 3,5 тыс.
Просмотров 830
50% 1

Event delegation, event bubbling, and event capturing are three related concepts in JavaScript that describe how events are handled and propagated in the Document Object Model (DOM).
Event delegation refers to the process of using a single event handler on a parent element to handle events for multiple child elements. For example, if you have a table with many rows, you could use a single event handler on the table to handle clicks on any of the rows, rather than attaching a separate event handler to each row. This can be more efficient and reduce the number of event handlers in your code.
Event bubbling refers to the way that events propagate up the DOM tree. When an event occurs on a child element, it bubbles up to the parent element, and then to the parent's parent, and so on. This means that if you have a click event on a button inside a div, the click event will be handled first by the button, then by the div, and then by the parent element of the div.
Event capturing is the opposite of event bubbling. It refers to the way that events propagate down the DOM tree. When an event occurs on an element, it is first captured by the parent element, then by the parent's parent, and so on. This means that if you have a click event on a button inside a div, the click event will be handled first by the parent element of the div, then by the div, and then by the button.
You can specify whether an event handler uses event bubbling or event capturing by using the addEventListener method and passing the appropriate value as the third argument. To use event bubbling, pass false as the third argument. To use event capturing, pass true as the third argument.
In summary, event delegation allows you to handle events for multiple child elements using a single event handler on a parent element. Event bubbling and event capturing refer to the way that events propagate through the DOM tree, with bubbling starting from the target element and propagating up to the parent element and Capturing starting from the parent element and propagating down to the target element.
React JS - stackblitz.com...
JavaScript - jsbin.com/puju...
On Instagram or twitter CodingScenes
/ codingscenes

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 4   
@yashwantmainkar2371
@yashwantmainkar2371 7 месяцев назад
you are amazing.👍👍 Thanks
@satyendrasingh9209
@satyendrasingh9209 Год назад
Bhut pucha jata hai yeh ajkal interviews mein, thanks for upload.
@codingscenes
@codingscenes Год назад
Most welcome brother. 🎊🎉🙏🙏. Happy new year 2023
@satyendrasingh9209
@satyendrasingh9209 Год назад
@@codingscenes Thanks Happy new year you too 😍 congratulations🎉🥳👏
Далее
Пчёлы некроманты.
00:46
Просмотров 23 тыс.
React Junior Developer Interview (Questions & Challenge)
1:06:19
Learn JavaScript Event Listeners In 18 Minutes
18:03
Просмотров 589 тыс.
Events in Javascript | chai aur #javascript
36:57
Просмотров 224 тыс.