Open In App

HTML <input> form Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <input> form Attribute is used to specify interactive input fields for web-based forms. A form can contain multiple input fields to accept inputs from the users. It is the most powerful element in HTML. 

Syntax:

<input form="form_id">

Attribute Value: This attribute contains a single value form_id which contains the value i.e form_id which specify the one or more than the button element belongs to. The value of this attribute should be the id of the <form> element. 

Example: This Example illustrates the use of form attribute in <input> element. 

html




<!DOCTYPE html>
<html>
  <body>
    <h1>GeeksforGeeks</h1>
 
    <h2>
        HTML &lt;input&gt; form Attribute
    </h2>
 
    <form id="myGeeks"></form>
    <br />
    Name:
    <input type="text" id="btn"
           name="myGeeks" form="myGeeks"/>
  </body>
</html>


Output:

  

Supported Browsers:

  • Google Chrome 1.0 and above
  • Edge 12.0 and above
  • Firefox 1.0 and above
  • Internet Explorer 5.5 and above
  • Apple Safari 1.0 and above
  • Opera 12.1 and above

Last Updated : 12 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads