jquery event source 1

jquery event source

//target is the element that triggered the event 
let source1 = event.target;
//currentTarget is the element that the event listener is attached to.
let source2 = event.currentTarget;

Here is what the above code is Doing:
1. The event listener is attached to the

element.
2. When the user clicks on the

, the event listener is triggered.
3. The event listener calls the function, which logs the event.target and event.currentTarget properties.
4. The event.target property is the

element, because that’s the element that was clicked on.
5. The event.currentTarget property is also the

element, because that’s the element that the event listener is attached to.

Similar Posts