DOM Interfaces

HTMLLinkElement

Represents relationships between a document and external resources or other documents. The rel token controls processing; href alone does not mean that the resource is loaded as a stylesheet. Example result: alternate.

Formal Syntax & Structure

html syntaxhtml
const element = document.getElementById('demo'); // HTMLLinkElement

Return Value

HTMLLinkElement

An existing HTML DOM object associated with the link element in this example; this interface is a type, not a function return contract.

Working Example

Example Snippethtml
<link id="demo" rel="alternate" href="https://example.com/feed"><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.rel);</script>
HTML Reference