HasCheckedState
API reference › HTML › Form › Mixin › HasCheckedState
Used by 2 types
Provides methods to configure the checked state of form elements like checkboxes and radio buttons.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
checked() | Sets the checked attribute. | HasCheckedState |
Method details
Section titled “Method details”checked()
Section titled “checked() ”public function checked(bool|float|int|mixed[]|string|Stringable|UnitEnum|null $value): staticSets the checked attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool|Stringable|UnitEnum| | Checked state. - array: Element is checked if the value is in the array. - false: Element is unchecked. - true: Element is checked. - float|: Element is checked if the value matches the value attribute, or on when the element has no value attribute. - null: Attribute is removed. |
Returns
static: New instance with the updated checked attribute.