X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript String anchor() Method

JavaScript String Reference JavaScript String Reference

Example

Create an HTML anchor around a string:

var txt = "Chapter 10";
txt.anchor("chap10");
alert(txt.anchor("chap10"));

Try it yourself »


Definition and Usage

The anchor() method is not standard, and may not work as expected in all browsers.

The anchor() method is used to create an HTML anchor.

This method returns the string embedded in the <a> tag, like this:

<a name="anchorname">string</a>


Browser Support

Method
anchor() Yes Yes Yes Yes Yes


Syntax

string.anchor("name")

Parameter Values

Parameter Description
name Required. The name of the anchor

Technical Details

Return Value: A string embedded in the <a> tag


JavaScript String Reference JavaScript String Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook