DOM Interfaces
HTMLInputElement
Represents input controls and provides type-dependent value, selection, file and constraint validation APIs. Properties such as valueAsNumber and selectionStart have type-specific applicability; changing a value in script does not automatically fire input. Example result: 12.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLInputElementReturn Value
HTMLInputElement
An existing HTML DOM object associated with the input element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<label> Count <input id="demo" type="number" value="12"></label><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.valueAsNumber);</script>Browser Compatibility
Minimum supported versions across modern rendering engines
Widely Available
Chrome
1
Yes
Edge
12
Yes
Firefox
1
Yes
Safari
1
Yes
Opera
8
Yes
Checked desktop BCD snapshot: HTMLInputElement interface, not every input type or member. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted.
HTML Living Standard