target Event Attribute
Complete Event Object Reference
Definition and Usage
The target event attribute returns the element that triggered the event.
Syntax
Example
The following example gets the element that triggered the event:
<html>
<head>
<script type="text/javascript">
function getEventTrigger(event)
{
x=event.target;
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>
|
Try-It-Yourself Demos
Get the
element that triggered the event
Complete Event Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|