Open gloriaJun opened 5 years ago
The DOM element on the lefthand side of the call that triggered this event
The EventTarget whose EventListeners are currently being processed. As the event capturing and bubbling occurs this value changes.
<div onclick="checkTarget();"> <span>test</span> </div>
function checkTarget(event) { console.log(event.currentTarget); // return 'div' DOM console.log(event.target); // return 'span' DOM }
target
The DOM element on the lefthand side of the call that triggered this event
currentTarget
The EventTarget whose EventListeners are currently being processed. As the event capturing and bubbling occurs this value changes.
Example
References