HTMLSelectElement.autofocus property has a value of either
false that reflects the
attribute, which indicates whether the associated
will get input focus when the page loads, unless the user overrides it.
Only one form-associated element in a document can have this attribute specified. If there are several, the first element with the attribute set inserted, usually the first such element on the page, get the initial focus.
Note: Setting this property doesn't set the focus to the associated
<select> element: it merely tells the browser to focus to it when
the element is inserted in the document. Setting it after the insertion, that
is most of the time after the document load, has no visible effect.
A boolean value.
<select id="mySelect" autofocus> <option>Option 1</option> <option>Option 2</option> </select>
// Check if the autofocus attribute on the <select> var hasAutofocus = document.getElementById('mySelect').autofocus;
No specification found
No specification data found for
Check for problems with this page or contribute a missing
spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.