The form attribute on a <select> tag specifies the form the dropdown is associated with.
The select will be included during the form submission.
A <select> element with a form attribute. Although outside the form, the dropdown is included during form submission.
<form action="/tutorial/action.html" id="size-form">
<fieldset>
<legend>Product Details</legend>
<input type="text" name="product"
placeholder="Product name"><br /><br />
<input type="submit" value="Submit">
</fieldset>
</form> <br />
<select name="size" form="size-form">
<option value="">-- Select Size--</option>
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
The form attribute specifies the form the select element is associated with.
This attribute value is the id of the form.
Once associated to a form, the select element is included during form submission.
<select form="form-id">
Value | Description |
---|---|
form-id | The id of the form. |
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
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |