How do you implement event delegation in JavaScript?
Add one listener on the parent: parent.addEventListener('click', e => { if (e.target.matches('li')) handle(e.target); }). Check e.target to determine which child was clicked.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in What Is Event Delegation in JavaScript?
Still have questions?
Browse all our FAQs or reach out to our support team
