DOM Interfaces

HTMLDetailsElement

Represents a native disclosure widget and exposes its open state and grouping name. Changing open changes the visible disclosure; toggle notifications can be coalesced. Use summary for the accessible disclosure label. Example result: true.

Formal Syntax & Structure

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

Return Value

HTMLDetailsElement

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

Working Example

Example Snippethtml
<details id="demo" open>  <summary>More</summary>  <p>Details</p></details><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.open);</script>
HTML Reference