Javascript examples for DOM:Event
The target event property returns the element that triggered the event.
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:
<!DOCTYPE html> <html> <body onclick="myFunction(event)"> <p>Click here.</p> <script> function myFunction(event) {//from w ww. j av a 2 s. c om console.log(event.target.nodeName); } </script> </body> </html>