Latest web development tutorials

HTML select autofocus attribute

HTML select tag Reference Manual HTML <select> tag

Examples

A drop-down list autofocus:

<select autofocus>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Opera, Chrome and Safari support autofocus attribute.

Note: 9 and earlier versions of Firefox or Internet Explorer does not support autofocus attribute <select> tag.


Definition and Usage

autofocus attribute is a Boolean attribute.

Autofocus attribute specifies the drop-down list automatically get the focus when the page loads.


Differences between HTML 4.01 and HTML5

autofocus attributes are new attributes in HTML5 <select> tag.


Differences between HTML and XHTML

In XHTML, prohibit attribute minimization, autofocus attribute must be defined as <select autofocus = "autofocus">.


grammar

<select autofocus>


HTML select tag Reference Manual HTML <select> tag