- Attribute of
- How To Use Input To Create Form Fields In HTML: Easy Tutorial
- What does
- Defines an initial value or default selection for an input field.
<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>
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.
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
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.
When used with a
image input type, the
value sets a fixed entry for the field, which cannot be changed. The value of
submit input types defines the text on the button. A
value for a
file input will be ignored by the browser.