Event Target
noun
say it: “ih-VENT TAR-git” /ɪˈvɛnt ˈtɑːrɡɪt/
The element an event actually happened on, such as the exact button that was clicked, which JavaScript gives you as event.target.
What is Event Target in JavaScript?
Event Target — The object on which an event was originally dispatched.
button.addEventListener("click", event => {
const clickedButton = event.target;
});
In a sentence
- “I read the target of the click and got the heart icon inside the button, not the button itself.”
- “The list had only one listener, and the event target told it which Adopt button was clicked.”
Level: Freelancer · More JavaScript terms at this level
Updated