DOM Interfaces
HTMLDataElement
Represents human-readable content paired with a machine-readable value. The value property is a string, not an automatic conversion of the displayed text. Example result: P12.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLDataElementReturn Value
HTMLDataElement
An existing HTML DOM object associated with the data element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<data id="demo" value="P12">Product</data><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>