Provides a way to direct a user to a specific field when a document loads.
Applies to [HTMLInputElement](/html/elements/input)This is the one of the important attribute introduced in HTML5 for UX. When used on an element, focus is set on that element on page load or when its dialog is shown (such as when a modal window is shown).
This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens.
This attribute is true when present on an element, and false when missing. Only one element on each page can have the autofocus field.
Examples<input id="search_box" autofocus>
Related specifications
autofocus
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4