HTML <input> autofocus Attribute
Example
<input type="text" id="lname" name="lname" autofocus>
Meaning
The autofocus is Boolean attribute is used to indicate that the user agent should immediately focus this form item once its containing window load.
No more than one element in the document may have the autofocus attribute. If put on more than one element, the first one with the attribute receives focus.
The autofocus attribute cannot be used on inputs of type hidden, since hidden inputs cannot be focused.
Standard Syntax
HTML: <input autofocus>
XHTML: <input autofocus="autofocus" />
Advertisement
Attribute Values
| Value | Description |
|---|---|
| autofocus | This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. |