Autofocus on a textfield after page load [HTML]
Problem
After page load, you want to put the focus on a textfield. For instance you have a form and you want to focus on the first field thus users can type immediately. See for instance the Google search page.
Solution
I tried several variations and this is what worked for me:
<body onload="document.login_form.email.focus()">
Here I suppose to have the following form:
<form name="login_form" action="process.php" method="POST">
<input type="text" name="email" />
...
</form>
This tip is from here.
Categories: html, javascript
focus
Comments (0)
Trackbacks (0)
Leave a comment
Trackback