Horje
HTML value Attribute

Definition and Usage

For <button>, <input> and <option> elements, the value attribute specifies the initial value of the element.

For <li> elements, the value attribute sets the value of the list item (for ordered lists). The next list items will increment from that value.

For <meter> elements, the value attribute specifies the current value of the gauge.

For <progress> elements, the value attribute specifies how much of the task has been completed.

For <param> elements, the value attribute specifies the value of the parameter.


Applies to

The value attribute can be used on the following elements:

Elements Attribute
<button> value
<input> value
<meter> value
<li> value
<option> value
<progress> value
<param> value

Browser Support

The value attribute has the following browser support for each element:


How to add Two buttons with equal names, that submit different values when clicked - HTML value Attribute

<button> Example.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The button value attribute</h1>

<form action="/action_page.php" method="get">
Choose your favorite subject:
<button name="subject" type="submit" value="fav_HTML">HTML</button>
<button name="subject" type="submit" value="fav_CSS">CSS</button>
</form>

</body>
</html>

Output should be:

How to add Two buttons with equal names, that submit different values when clicked - HTML value Attribute

How to add An HTML form with initial (default) values - HTML value Attribute

<input> Example.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The input value attribute</h1>

<form action="/action_page.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>

</body>
</html>

Output should be:

How to add An HTML form with initial (default) values - HTML value Attribute

How to add An HTML form with initial (default) values - HTML value Attribute

<input> Example.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The input value attribute</h1>

<form action="/action_page.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>

</body>
</html>

Output should be:

How to add An HTML form with initial (default) values - HTML value Attribute

How to add Use of the value attribute in an ordered list - HTML value Attribute

<li> Example.
index.html
Example: HTML
 <ol>
  <li value="100">Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Water</li>
  <li>Juice</li>
  <li>Beer</li>
</ol> 

Output should be:

How to add Use of the value attribute in an ordered list - HTML value Attribute

How to add A gauge with a current value, min, max, high, and low segments - HTML value Attribute

<meter> Example.
index.html
Example: HTML
 <meter min="0" low="40" high="90" max="100" value="95"></meter> 

Output should be:

How to add A gauge with a current value, min, max, high, and low segments - HTML value Attribute

How to add A drop-down list inside an HTML form - HTML value Attribute

<option> Example.
index.html
Example: HTML
 <form action="/action_page.php">
  <select name="cars">
    <option value="volvo">Volvo XC90</option>
    <option value="saab">Saab 95</option>
    <option value="mercedes">Mercedes SLK</option>
    <option value="audi">Audi TT</option>
  </select>
  <input type="submit" value="Submit">
</form> 

Output should be:

How to add A drop-down list inside an HTML form - HTML value Attribute

How to add Downloading in progress - HTML value Attribute

<progress> Example.
index.html
Example: HTML
 <progress value="22" max="100"></progress> 

Output should be:

How to add Downloading in progress - HTML value Attribute

How to Set the "autoplay" parameter to "true", so the sound will start playing as soon as the page loads - HTML value Attribute

<param> Example.
index.html
Example: HTML
 <object data="horse.wav">
  <param name="autoplay" value="true">
</object> 

Output should be:

How to Set the "autoplay" parameter to "true", so the sound will start playing as soon as the page loads - HTML value Attribute




html value attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference