Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

currentTarget Event Attribute

currentTarget Event Attribute

Event Object Reference 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:

Runoob Tutorial(runoob.com)

    

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 Reference Event Object