JavaScript anchor() method
JavaScript String object
Definition and Usage
The anchor() method is used to create an HTML anchor.
This method returns the string with an tag added, as shown below:
Syntax
string
.anchor(name)
| Parameters | Description |
|---|---|
| name | Required. The name of the anchor |
Browser support





All major browsers support the anchor() method.
Example
Example
Create an HTML anchor:
Try it »
JavaScript String object