Global Attributes
HTML autofocus attribute
Requests initial focus when the document or relevant dialog or popover is shown. Avoid unexpected focus changes that disorient keyboard or screen reader users. Applicability: global HTML attribute, subject to element-specific restrictions and browser support. Boolean syntax: presence enables the state; omit the attribute to disable it. A string value of "false" does not turn it off.
Formal Syntax & Structure
html syntaxhtml
autofocusParameters & Attributes
| Name | Type | Description |
|---|---|---|
| autofocus | boolean | Requests initial focus when the document or relevant dialog or popover is shown. Avoid unexpected focus changes that disorient keyboard or screen reader users. |
Working Example
Example Snippethtml
<label> Search <input type="search" autofocus></label>