HTML <select> autofocusAttribute
Examples
A drop-down list that automatically gets focus:
<select autofocus>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
Internet Explorer 10, Opera, Chrome, and Safari support the autofocus attribute.
Note:Firefox or Internet Explorer 9 and earlier versions do not support the autofocus attribute of the <select> tag.
Definition and Usage
The autofocus attribute is a boolean attribute.
The autofocus attribute specifies that the drop-down list automatically gets focus when the page loads.
Differences between HTML 4.01 and HTML5
The autofocus attribute is a new attribute for the <select> tag in HTML5.
Differences between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the autofocus attribute must be defined as <select autofocus="autofocus">.
Syntax
<select autofocus>
HTML <select> Tag Other Extensions