Find out what function is being called by an object's onclick event - Javascript DOM Event

Javascript examples for DOM Event:onclick

Description

Find out what function is being called by an object's onclick event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*w  w  w.j  a  va 2s. c  om*/
div1 = document.getElementById('div1');
console.log(div1.getAttribute("onclick"));
    }

      </script> 
   </head> 
   <body> 
      <div id="div1" onclick="myfun();">  
      </div>
   </body>
</html>

Related Tutorials