Web APIs

HTMLInputElement.defaultValue

Try the free JavaScript compiler

Reflect the value attribute, which is the baseline used when a form resets a text input. It can differ from the edited value. Example console output: original edited.

Formal Syntax & Structure

javascript syntaxjavascript
input.defaultValue

Return Value

string

Default value attribute.

Working Example

Example Snippetjavascript
const i=document.createElement("input"); i.defaultValue="original"; i.value="edited"; console.log(i.defaultValue,i.value);
JavaScript Reference