Javascript examples for jQuery:Form Input
Autofocus to input when user starts typing on window
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.2.min.js"></script> <script type="text/javascript"> window.onload=function(){//w w w. j a v a 2 s . c om $(window).keypress(function() { $("#field").focus(); }); } </script> </head> <body> <input id="field" type="text"> </body> </html>