Handle Reference error - Javascript Function

Javascript examples for Function:Function Argument

Description

Handle Reference error

Demo Code

ResultView the demo in separate window

<html lang="en">
   <body> 
      <span id="counter" onclick="test(this.id)">1,234,567.15</span>  
      <script>
function test(event) {/*w  ww  .ja  va 2 s.c o  m*/
    console.log(arguments[0]);
    console.log(event);//counter,because you pass id 'counter' ,you didn't pass event
}

      </script> 
   </body>
</html>

Related Tutorials