How to add the value of the element in HTML?

HTMLWeb DevelopmentFront End Technology

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 −

 Live Demo

<!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

raja
Updated on 24-Jun-2020 12:18:52

Advertisements