MDN self-hosted library · e01.org

HTMLInputElement: defaultValue property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<label for="planet">Which planet were you born on?</label>
<input id="planet" type="text" value="Azarath" />
js
const inputElement = document.querySelector("#planet");
console.log(`Original value: ${inputElement.defaultValue}`); // "Original value: Azarath"