CurrentTarget vs Target differences

Javid Salim
Mar 3, 2023

--

Today I will try to show the difference between currentTarget and target with examples. Usually we can encounter such questions in interviews. Therefore, I will give a general explanation.

The html code is as follows

html block

The jscode is as follows

For css i used mvp.css. The default screen is like below

When we clikc on section tag the name of currentTarget and target will be written below accordingly

I repeat this process in several places. This is my form.

And this is on button:

As it is clear from the pictures, whatever tag the event is attached to is the current target, but the target has changed as a result of delegation.

--

--