HTML <input> formAttribute
Examples
An input field located outside the form (but still part of the form):
<form action="demo-form.php" id="form1">
First name: <input type="text" name="fname"><br>
<input type="submit" value="提交">
</form>
First name: <input type="text" name="fname"><br>
<input type="submit" value="提交">
</form>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
Except for Internet Explorer, almost all mainstream browsers support the form attribute.
Definition and Usage
The form attribute specifies one or more forms to which the <input> element belongs.
Differences Between HTML 4.01 and HTML5
The form attribute is a new attribute in HTML5.
Syntax
<input form="form_id">
Attribute Values
| Value | Description |
|---|---|
| form_id | Specifies a space-separated list of ids of one or more forms to which the <input> element belongs. |
HTML <input> Tag Other Extensions