Set the Name of the Form Element in HTML



Use the form attribute in HTML to set the name of the one or more form the element belongs to in HTML.

Example

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

<!DOCTYPE html>
<html>
   <body>
      <form action = "" method = "get" id = "myform">
         SubjectID: <input type = "number" name = "subid"><br>
         Subject Name: <input type = "text" name = "subname"><br>
         Total Students: <input type="number" name = "stcount"><br>
      </form>
      <button type = "submit" form = "myform" value = "Submit">Click</button>
   </body>
</html>
Updated on: 2020-05-30T23:45:14+05:30

117 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements