HasCharset
API reference › HTML Attribute › HasCharset
Used by 1 type
Provides an immutable API for the charset attribute.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta#charset.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
charset() | Sets the charset attribute. | HasCharset |
Method details
Section titled “Method details”charset()
Section titled “charset() ”public function charset(string|Stringable|UnitEnum|null $value): staticSets the charset attribute.
Declares the document character encoding.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Character encoding token, or null to remove the attribute. |
Returns
static: New instance with the updated charset attribute. Charset for predefined enum values.
Throws
InvalidArgumentException: If the value is not valid.