Hello Friends,
Here i am going to teach your very important topic of javascript that is Event Delegation.
What is Event Delegation in JavaScript?
Ans:DOM event delegation is used for responding to user events via a single parent rather than each child node. With it, you can bind an event handler to a common parent element that will handle any event happening on one of its children:
Advantages :
This has a couple of advantage over of using event listeners on individual elements:
You can respond to user events with one listener, which creates a leaner and more readable code. You don’t need to rebind events if nodes are added through JavaScript.
For practical example watch the video till the end.
If you like then please subscribe the channel and share with your friends.
#dscode#EventDelegationInJavascript