Back to Content

HTMLAnchorElement: rel property

files/en-us/web/api/htmlanchorelement/rel/index.md

latest818 B
Original Source

{{APIRef("HTML DOM")}}

The HTMLAnchorElement.rel property reflects the rel attribute. It is a string containing a space-separated list of link types indicating the relationship between the resource represented by the {{HTMLElement("a")}} element and the current document.

Value

A string.

Examples

js
const anchors = document.getElementsByTagName("a");
for (const anchor of anchors) {
  alert(`Rel: ${anchor.rel}`);
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • The equivalent property on {{HTMLElement("area")}} and {{HTMLElement("link")}}, {{domxref("HTMLAreaElement.rel")}} and {{domxref("HTMLLinkElement.rel")}}.
  • The very same list but as tokens: {{domxref("HTMLAnchorElement.relList")}}