target Event Property
Event Object
Definition and Usage
The target event property returns the element that triggered the event.
Syntax
Example
Example
The following example gets the element that triggered the event:
<html>
<head>
<script>
function myFunction(e)
{
alert(e.target);
}
</script>
</head>
<body>
<p onclick="myFunction(event)">
Click on this paragraph. An alert box will
show which element triggered the event.</p>
</body>
</html>
Try it yourself »
Event Object
Thank You For Helping Us!
Your message has been sent to W3Schools.
Close [X]