myEvent.currentTarget in DOM Level 2 Events

The object to which the event handler was assigned.
This property is read-only.

Property Type

The following (HTML-centric) example shows the difference between Event.currentTarget and

<p id="para">
	Hello <b id="bold" style="padding:1em; background-color:yellow">World</b>
<script type="text/javascript">
	function SayWhoCaughtMe(evt){
		alert("target is :";
		alert("currentTarget is :";

In the above, if the user clicks in the yellow area around the word "World", the first alert will show 'bold'; refers to the top-most object which caught the event. The second alert will say 'para', as currentTarget always refers to the object to which the event handler was assigned.

Note that if the user clicks on the word "World" itself, or the word "Hello", the first alert may show 'undefined', as may refer to the Text node containing the text. (Safari behaves this way, while Mozilla does not support event trapping on Text nodes, instead always setting target to the parent node of any text.)

Unlike, there is no equivalent for the currentTarget property in Internet Explorer's event object.