So in a nutshell we can say that event.target returns a reference of the element the event was called upon and event.currentTarget returns it's parent element/container !
Same rules for event.target applies here, but as for event.currentTarget, regardless of the children of randomDivId that you click, it will always return the randomDivId element.
So in a nutshell we can say that event.target returns a reference of the element the event was called upon and event.currentTarget returns it's parent element/container !
You're right about event.target.
For event.currentTarget, it returns a reference to the element that fired the event.
e.g
Same rules for event.target applies here, but as for event.currentTarget, regardless of the children of
randomDivId
that you click, it will always return therandomDivId
element.Hope you get it now?
That makes sense .Thanks