HTML CSS examples for HTML Tag:input
The autofocus attribute is a boolean attribute to set if an <input> element should automatically get focus when the page loads.
In XHTML, the autofocus attribute must be defined as <input autofocus="autofocus" />.
The following code shows how to Let the "First name" input field automatically get focus when the page loads:
<!DOCTYPE html> <html> <body> <form action="/action_page.php"> First name: <input type="text" name="fname" autofocus><br> Last name: <input type="text" name="lname"><br> <input type="submit"> </form><!-- w w w . ja v a 2 s . c om--> </body> </html>