Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The value property of the HTMLInputElement interface represents the current value of the <input> element as a string.
This property can also be set directly, for example to set a default value based on some condition.
A string specifying the default value of the <input> element.
In this example, the log displays the current value as the user enters data into the input.
We include an <input> and an associated <label>, with a <pre> container for our output.
The <pre> element's innerText is updated to the current value of the <input> every time a keyup event is fired.
This example demonstrates that the value property with an <input> of type color.
We include an <input> of type color:
The <pre> element's innerText is updated with the default color value (#000000) and then updated every time a change event is fired.
| HTML # dom-input-value |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 22, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.