Javascript examples for DOM:Element focus
Use element focus() method to move cursor
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w. ja v a 2s . co m*/ 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>