The above example demonstrates usage of the <select> element with the autofocus attribute.

When you load this page, the <select> control already has the focus. To test this, use a short-cut key to make a selection from the list (for example, press the "Down" arrow on your keyboard). Pressing this key should open the list, displaying all options. If the element didn't have focus, this wouldn't happen.

Note that there must not be more than one element in the document with the autofocus attribute specified.

Boolean Attribute

The autofocus attribute is a boolean attribute. If it is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either autofocus or autofocus="autofocus").