How to specify which form element a calculation is bound to with HTML?

HTMLWeb DevelopmentFront End Technology

Use the for attribute in HTML to specify which form element a calculation is bound to with HTML.

Example

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

<!DOCTYPE html>
<html>
   <body>
      <p>Education:</p>

      <form action="">
         <label for = "graduate">Graduate</label>
         <input type = "radio" name = "education" id = "graduate" value = "graduate"><br>

         <label for = "ugraduate">Under-graduate</label>
         <input type = "radio" name = "education" id = "ugraduate" value = "ugraduate"><br>
         <input type = "submit" value = "Submit">
      </form>

   </body>
</html>
raja
Updated on 03-Mar-2020 09:45:56

Advertisements