Javascript examples for DOM Event:onclick
pass the id of an element that triggers an `onclick` event to the event handling function
<html lang="en"> <head> <title> mrmoje</title> <style> div{cursor:pointer} div:hover{text-decoration:underline} </style> </head> <body translate="no"> <div onclick="myHandler()" id="my element's id"> Click Here//from w ww . ja v a 2 s . c o m </div> <script> function myHandler(){ console.log(myHandler.caller.arguments[0].target.id) } </script> </body> </html>