event.target
The event property holding the element where the event actually started, such as the icon inside a button that was clicked.
In more detail
event.target stays the same as the event bubbles, while event.currentTarget changes to whichever element's listener is running. Delegation combines target with closest() to find the relevant control.
Related terms
- event.currentTarget — The event property holding the element whose listener is running right now, which changes as the event moves along its path.
- event delegation — Handling events for many child elements with one listener on a shared ancestor, using event.target to find which child was involved.
- Element.closest() — The DOM method that starts at an element and walks up through its ancestors, returning the first one, itself included, that matches a selector.
Taught in
- Event Phases: Capturing, Target And Bubbling Demystified — Frontend Architecture & Web Platform
- Event Delegation: Memory-Efficient Interaction Handlers — Frontend Architecture & Web Platform