Glossary: JavaScript in the Browser
Event delegation
Putting one listener on a parent and using event.target with closest to work out which child was clicked. It also works for children added later, as with the shop's Add to cart buttons.
Glossary: JavaScript in the Browser
Putting one listener on a parent and using event.target with closest to work out which child was clicked. It also works for children added later, as with the shop's Add to cart buttons.