DOM Interfaces
HTMLOutputElement
Represents the displayed result of a calculation or user action and exposes a current and default value. The element does not compute results automatically; update it from application code. Its value is not a submitted form field. Example result: 42.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLOutputElementReturn Value
HTMLOutputElement
An existing HTML DOM object associated with the output element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<output id="demo" name="total">42</output><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.value);</script>