Lightning Web Components: Exploring the Contrast Between event.target and event.currentTarget
event. currentTarget tells us on which element the event was attached to or the element whose eventListener triggered the event.
event. target tells where the event started.
Understanding the distinction between these two is very important in effective Event handling in LWC. The below example will make it clear.
testEventTarget.html
testEventTarget.js
Click
Click
Output