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

HTML DOM anchors Collection

Document Object Reference Document Object

Example

Return the number of anchors in the document:

document.anchors.length;

Try it yourself »

Definition and Usage

The anchors collection returns a collection of all the anchors in the current document.

The anchors collection contains anchors created with the name attribute.

The <a> name attribute is not supported in HTML5.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The anchors collection is supported in all major browsers.


Syntax

document.anchors

Technical Details

Return Value: A NodeList object, representing a collection of anchors
DOM Version Core Level 2 Node Object


More Examples

Example

Return the innerHTML of the first anchor in the document:

document.anchors[0].innerHTML;

Try it yourself »


Document Object Reference Document Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE