event delegation in javascript code example
Example: event delegation javascript
Explain event delegation :
“Js event listeners fire not only on a single DOM element
but on all its descendents”
The idea is that if we have a lot of elements handled in a
similar way, then instead of assigning a handler to each of
them – we put a single handler on their common ancestor.