HTML value Attribute
Example
<form action="action3.html" method="get">
Click the button.
<button name="subject" type="submit" value="HTML">HTML</button>
<button name="subject" type="submit" value="CSS">CSS</button>
<button name="subject" type="submit" value="JavaScript">JavaScript</button>
</form>
Meaning
The value attribute defines the value for elements(initial value for some elements).
Standard Syntax
<element value="text">
Browser Support
Status
Applies to:
The value attribute can be used on the following element:
Element | Attribute |
---|---|
<button> | value |
<data> | value |
<input> | value |
<li> | value |
<meter> | value |
<option> | value |
<param> | value |
<progress> | value |
Attribute Values
Value | Description |
---|---|
text | Specifies the value of the button. |
<data> Tag Example
<p>Product List</p>
<ul>
<li><data value="001">Book</data></li>
<li><data value="002">Pen</data></li>
<li><data value="003">Pencil</data></li>
</ul>
<input> Tag Example
<form action="action.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname" value="John"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<li> Tag Example
<ol>
<li value="three">One</li>
<li>Two</li>
<li>Three</li>
</ol>
<meter> Tag Example
Example
<p><label for="a">A score:</label>
<meter id="a" min="0" low="40" high="90" max="100" value="60"></meter></p>
<p><label for="b">B score:</label>
<meter id="b" min="0" low="40" high="90" max="100" value="85"></meter></p>
<option> Tag Example
Example
<form action="action.php">
<label for="lang">Choose a language:</label>
<select id="lang" name="lang">
<option value="HTML">HTML</option>
<option value="CSS">CSS</option>
<option value="JavaScript">JavaScript</option>
</select>
<input type="submit" value="Submit">
</form>
<param> Tag Example
Example
<object data="demo/video.mp4">
<param name="videplay" value="true">
</object>
<progress> Tag Example
Example
<label for="loading">Loading progress:</label>
<progress id="loading" value="55" max="100"> 55% </progress>