javascript.info The Modern JavaScript Tutorial Part 2: 2.3 Event Delegation




javascript.info The Modern JavaScript Tutorial Part 2: 2.3 Event Delegation by Ilya Kantor
Youtube by Lisa Friedrichsen
This youtube gives a simple example of event delegation using a bingo scorecard. Event delegation allows you to write one event handler, attach it to a parent element, and trigger the same handler on all child elements through bubbling.
It also covers the event object, an object that is automatically created when a user interacts with a web page such as when the user clicks an element. The youtube shows you how to access the event object and its target property in a function to determine exactly what has been clicked. Together the two concepts allow you to write one event handler and apply it to a specific element on the page.

Original source