HTML <input> formAttribute

HTML input 标签参考手册HTML <input> Tag

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>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 标签参考手册HTML <input> Tag Other Extensions