The form attribute on an <input> tag specifies the form the input element is associated with.
The input element will be included during the form submission.
An <input> field with a form attribute. Although outside the form, this input field is included during form submission.
<form action="/tutorial/action.html" id="myform">
<fieldset style="background: #f6f8ff; border: 2px solid #4238ca;">
<legend>Personal Information</legend>
<input type="text" name="firstname" placeholder="First name">
<br /><br />
<input type="submit" value="Submit">
</fieldset>
</form> <br />
<input form="myform" type="text" name="lastname" placeholder="Last name">
The form attribute specifies the form the input element is associated with.
The attribute value is the id of the form.
Once associated with a form, the input element is included during form submission.
<input form="form-id">
Value | Description |
---|---|
form-id | The id of a form element. |
Here is when form support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
10.6 | Jul 2010 |
Safari
|
5.1 | Oct 2011 |