HTML DOM links collection
Document Object
Definition and Usage
The links collection returns an array of all links in the current document.
Tip: The links collection counts tags and tag.
Syntax
document.links[]
.property
Browser support





All major browsers support the links collection
Example
Example 1
Returns the number of links in the document:
Number of links/addresses:
The example above produces the following output:
Number of links/addresses: 4
Try it »
Example 2
Returns the first link of the document:
ID of the first link/address:
The example above produces the following output:
ID of the first link/address: sun
Try it »
Document Object