Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript anchor() method

JavaScript anchor() method

String Object Reference 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:

string

Syntax

string

.anchor(name)

Parameters Description
name Required. The name of the anchor

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the anchor() method.


Example

Example

Create an HTML anchor:

Try it »


String Object Reference JavaScript String object