XML DOM currentTarget event property

Definition and Usage

The currentTarget event property returns the node that the listener triggered the event, that is, the element, document, or window that is currently handling the event.

This property is very useful in the capture and bubble phases, because in these two nodes, it is different from the target property.

Syntax

event.currentTarget

Example

The following example shows which element's listener triggered the event:

<html>
<head>
<script type="text/javascript">
function getEventTrigger(event)
  { 
  x=event.currentTarget; 
  alert("The id of the triggered element: "
  + x.id);
  }
</script>
</head>
<body >
<p id="p1" onmousedown="getEventTrigger(event)">
Click on this paragraph. An alert box will
show which element triggered the event.</p>
</body>
</html>

TIY

currenttarget event
যে এলিমেন্টটির লিস্টেনার ইভেন্টটি ট্রিগার করেছে তার ইলিমেন্টটি পাওয়া যায়。