HasMaxlength
API reference › HTML › Form › Mixin › HasMaxlength
Used by 7 types
Provides an immutable API for the maxlength attribute.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/maxlength.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
maxlength() | Sets the maxlength attribute. | HasMaxlength |
Method details
Section titled “Method details”maxlength()
Section titled “maxlength() ”public function maxlength(int|string|Stringable|UnitEnum|null $value): staticSets the maxlength attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | int|Stringable|UnitEnum| | Maximum length. Must be ’>= 0’, or null to remove the attribute. |
Returns
static: New instance with the updated maxlength attribute.
Throws
InvalidArgumentException: if the value is not an integer-like value ’>= 0’.