Because the parent listener receives all clicks within the parent, including clicks on non-child areas. Check e.target.tagName or e.target.matches() to ensure the click was on a relevant child before handling.
Why should you check e.target in event delegation?
More FAQs in Event Bubbling Common Mistakes
Because of event bubbling. The click event propagates from the child up to the parent. To prevent this, call e.stopPropagation() in the child's handler.
Because it prevents event delegation from working. Delegation relies on events bubbling to a parent listener. If you stop propagation, the parent never receives the event. Only stop when necessary.
e.target is the element that triggered the event (the actual clicked element). e.currentTarget is the element the listener is registered on. In delegation, e.target is the child, e.currentTarget is the parent.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.