How do you identify which child was clicked in event delegation?
Check e.target: if (e.target.tagName === 'LI') ... or if (e.target.matches('.item')) ... e.target is the element that triggered the event (the actual clicked child).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How Event Bubbling Enables Event Delegation
When a child is clicked, the event bubbles to the parent. A listener on the parent checks e.target to determine which child was clicked. Without bubbling, the parent would never receive the child's click event.
Fewer listeners (memory-efficient), works for dynamically added children (no need to add new listeners), and simpler code (one handler instead of many).
Yes. Since the listener is on the parent (which already exists), new children's clicks bubble to the same parent listener. No need to add new listeners for new children. This is a key advantage.
Still have questions?
Browse all our FAQs or reach out to our support team
