target Event Property - Javascript DOM

Javascript examples for DOM:Event


The target event property returns the element that triggered the event.

Return Value

A reference to the object on which the event originally occured

The following code shows how to get the element that triggered a specific event:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<body onclick="myFunction(event)">

<p>Click here.</p>

function myFunction(event) {//from w ww. j  av a  2  s. c  om


Related Tutorials