HTML <select> autofocus attribute

Definition and Usage

autofocus The attribute is a boolean attribute.

When present, it specifies that the dropdown list should automatically gain focus when the page is loaded.

Example

Dropdown list with automatic focus:

<label for="cars">Please select a car brand:</label>
<select name="cars" id="cars" autofocus>
  <option value="audi">Audi</option>
  <option value="byd">BYD</option>
  <option value="geely">Geely</option>
  <option value="volvo">Volvo</option>
</select>

Try It Yourself

Syntax

<select autofocus>

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported 10.0 Not Supported Supported Supported