Handle Input field Focus Event trigger and action handler - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Handle Input field Focus Event trigger and action handler

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
function myFunction() {/*from   www  .  ja  va2s.  c o m*/
    var isFocused = "It worked!";
    document.getElementById("message").innerHTML = isFocused;
}
        
      </script> 
   </head> 
   <body> 
      <div id="message">
         empty string
      </div> 
      <input type="text" onfocus="myFunction()">  
   </body>
</html>

Related Tutorials