Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

document.links Redirect 1

« document

Summary

The links property returns a collection of all AREA elements and anchor elements in a document with a value for the href attribute.

Syntax

nodeList = document.links 

Example

var links = document.links;
for(var i = 0; i < links.length; i++) {
  var linkHref = document.createTextNode(links[i].href);
  var lineBreak = document.createElement("br");
  document.body.appendChild(linkHref);
  document.body.appendChild(lineBreak);
}

Specification

DOM Level 2 HTML: links

Document Tags and Contributors

 Last updated by: Sheppy,