currentTarget Event Attribute
Event Object
Definition and Usage
The currentTarget event attribute returns the node whose listener triggered the event, that is, the element, document, or window currently handling the event.
During the capture and bubbling phases, this attribute is very useful because at these two phases it differs from the target attribute.
Syntax
event
.currentTarget
Example
Example
The following example obtains which element's listener triggered the event:
Click this paragraph. An alert box will alert the element whose eventlistener triggered the event.
Note: The currentTarget attribute does not necessarily return the clicked element; it returns the element whose eventlistener triggered the event.
Try it »
Event Object