Pass this to event handler Function - Javascript DOM Event

Javascript examples for DOM Event:event function

Description

Pass this to event handler Function

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function hideValue(that, value) {
    if (that.value === value) {/*from   w w w .  j  ava  2 s  . c o m*/
        that.value = '';
    }
}

      </script> 
   </head> 
   <body> 
      <input onfocus="hideValue(this, 'First Name')" type="text" name="first_name" value="First Name">  
   </body>
</html>

Related Tutorials