Output would always be child
because event.target
is a reference to the object onto which the event was dispatched. To get the current HTML Element whose handler is being executed, use the property event.currentTarget
.
Further resources:
https://developer.mozilla.org/en-US/docs/Web/API/Event/target
https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
For useful and amazing frontend and programming tutorials: https://bit.ly/devtools-yt