Wednesday, November 17, 2021

Event delegation?

Event delegation is the process of not to add event to a target element , add the event to the parent element.

Use cases for event delegation-

1. When we have an element with lots of its child element that we are interested in .

2.When we want an event handler attached to an element but not exist in DOM when page is loaded .

No comments:

Post a Comment

Clean code chapter 3(Robert C.martin)

  Summary: --------  1. Functions should hardly ever be 20 lines long.  2.Keep blocks (inside if, else, while, for, etc.) short.  Ideally, j...