New in HTML5.

<input autofocus>

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
How To Use Input To Create Form Fields In HTML: Easy Tutorial
What does <input autofocus> do?
Specifies that the input field should be in focus immediately upon page load.

Code Example

<form>
 <label for="name">Name</label><br>
 <input name="name" id="name" autofocus>

Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for autofocus

iefirefoxchromeedgesafariopera
10434513934