The value attribute on an <input> tag sets the value of the element.
The meaning and usage of the value depends on type of <input> element.
Different <input> types, each one with a value.
These values are sent during form submission.
<form action="/tutorial/action.html">
<fieldset>
<legend>Edit User Information</legend>
First name <input type="text" name="firstname" value="Alex"><br /><br />
Last name <input type="text" name="lastname" value="McNeil"><br /><br />
<label>Gender</label>
<label for="male"><input type="radio" id="male" name="gender" value="male" checked> Male</label>
<label for="female"><input type="radio" id="female" name="gender" value="female"> Female</label>
<label for="other"><input type="radio" id="other" name="gender" value="other"> Other</label><br /><br />
<input type="hidden" name="userid" value="819404">
<input type="submit" value="Submit">
</fieldset>
</form>
The value attribute specifies the value of the input element.
The semantics (meaning) of the value attribute depends on the input type. For example:
Note: The value attribute applies to all input types, except type="file"
.
<input value="text">
Value | Description |
---|---|
text | An alphanumeric string. |
Here is when value support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |
Back to <input>