HasTarget
API reference › HTML Attribute › HasTarget
Provides an immutable API for the target attribute.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/target.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
target() | Sets the target attribute. | HasTarget |
Method details
Section titled “Method details”target()
Section titled “target() ”public function target(string|UnitEnum|null $value): staticSets the target attribute.
Defines the browsing context that receives the link or form submission.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|UnitEnum| | Browsing context name, or null to remove the attribute. |
Returns
static: New instance with the updated target attribute. Target for predefined enum values.
Throws
InvalidArgumentException: If the value is not valid.