Computer >> Computer tutorials >  >> Programming >> HTML

How to add the value of the element in HTML?


Use the value attribute to add the value of the element in HTML. It works with the following elements − <button>, <input>, <li>, <option>, <meter>, <progress>, <param>.

Example

You can try to run the following code to implement value attribute −

<!DOCTYPE html>
<html>
   <body>
      <head>
         <title>HTML value attribute</title>
      </head>
      <p>Gender</p>
      <form>
         <input type = "radio" name = "gender" value = "male">Male
         <br>
         <input type = "radio" name = "gender" value = "female">Female
      </form>
   </body>
</html>

Output

How to add the value of the element in HTML?