move the cursor into a input text box by clicking on html button? - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

move the cursor into a input text box by clicking on html button?

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  v  a 2  s . com*/
document.getElementById('my_button').onclick = function() {
    document.getElementById('my_textbox').focus();
};
    }

      </script> 
   </head> 
   <body> 
      <input type="text" id="my_textbox" value="My Text"> 
      <button id="my_button">Focus</button>  
   </body>
</html>

Related Tutorials