Check event function parameter - Javascript DOM

Javascript examples for DOM:Event

Description

Check event function parameter

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  ww. j  a v a 2 s  .  c  o m

window.callFn = function(evt, type) {
   if (type === 'child') {
     console.log(type);
  }
}
    }

      </script> 
   </head> 
   <body>  
      <button id="parent" onclick="callFn(event, 'parent')"> 
         <span id="child" onclick="callFn(event, 'child')">Authenticate</span> 
      </button>   
   </body>
</html>

Related Tutorials