<input value=””>

Attribute of
<input> HTML Tag
What does <input value=""> do?
Defines an initial value or default selection for an input field.

Code Example

<form>
<p>Please complete the form.</p>
<input type="text" name="yourname" value="Your Name"><br>
<input type="text" name="youremail" value="Your Email address"><br>
</form>

Please complete the form.



The value of an input element defines its default settings. This is the default state of the form when the page is loaded, or when the reset button is pressed.

Default Behavior

The effects of value vary, depending on the type of input. Below is a brief summary of its functionality for some example input types.

Default Text Field Values

The value of a text or password field pre-fills the field with a default entry. In password fields, this value will always be obfuscated.

Default Selection Field Values

value can also be used to set the default state of checkboxes and radio buttons, so that certain selections are the default when the page loads. The user can then adjust the fields to their liking.

Other Types

When used with a hidden or image input type, the value sets a fixed entry for the field, which cannot be changed. The value of button, reset and submit input types defines the text on the button. A value for a file input will be ignored by the browser.

Claire is an HTML enthusiast.