DOM Interfaces

HTMLTitleElement

Represents the document title text and exposes its text property. A document title identifies a page in browser UI; it is not the same as a visible page heading. Example result: Guide.

Formal Syntax & Structure

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

Return Value

HTMLTitleElement

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

Working Example

Example Snippethtml
<title id="demo">Guide</title><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.text);</script>
HTML Reference