CanBeAutofocus
API reference › HTML Attribute › Global › CanBeAutofocus
Used by 18 types
UIAwesome\Html\Core\Element\BaseBlockUIAwesome\Html\Form\AbstractInputDateTimeUIAwesome\Html\Form\ButtonUIAwesome\Html\Form\InputCheckboxUIAwesome\Html\Form\InputColorUIAwesome\Html\Form\InputEmailUIAwesome\Html\Form\InputFileUIAwesome\Html\Form\InputImageUIAwesome\Html\Form\InputNumberUIAwesome\Html\Form\InputPasswordUIAwesome\Html\Form\InputRadioUIAwesome\Html\Form\InputRangeUIAwesome\Html\Form\InputResetUIAwesome\Html\Form\InputSearchUIAwesome\Html\Form\InputSubmitUIAwesome\Html\Form\InputTelUIAwesome\Html\Form\InputTextUIAwesome\Html\Form\InputUrl
Provides an immutable API for the autofocus attribute.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
autofocus() | Sets the autofocus attribute. | CanBeAutofocus |
Method details
Section titled “Method details”autofocus()
Section titled “autofocus() ”public function autofocus(bool|null $value): staticSets the autofocus attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool| | Whether to enable autofocus. Use true to enable, false to disable, or null to remove the attribute. |
Returns
static: New instance with the updated autofocus attribute.