English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The input value attribute specifies the value of the <input> element, and the way the value attribute is used varies depending on the type of input field.
HTML form with an initial (default) value:
!DOCTYPE html> <html> <head> <title>HTML:<input> value attribute - 基础教程网(oldtoolbag.com)</title> <body> <form action="action_page.php"> Username: <input type="text" name="usrname" value="Jack"><br> Password: <input type="password" name="password" value="123456><br> <input type="submit" value="Submit"> </form> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the value attribute.
The value attribute specifies the value of the <input> element.
The way the value attribute is used for different input types varies:
For "button", "reset", and "submit" types - Define the text on the button
For "text", "password", and "hidden" types - Define the initial (default) value of the input field
For "checkbox", "radio", and "image" types - Define the value associated with the input element, which will be sent to the form's action URL when the form is submitted.
Note:The value attribute is required for <input type="checkbox"> and <input type="radio">.
Note:The value attribute cannot be used with <input type="file">.
none.
<input value="text">
value | description |
---|---|
text | Specify the value of the <input> element. |