Skip to content
Related Articles

Related Articles

HTML <input> form Attribute

View Discussion
Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 12 Aug, 2022
View Discussion
Improve Article
Save Article

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!