HTML <select> form Attribute

The form attribute on a <select> tag specifies the form the dropdown is associated with. The dropdown will be included during form submission.

Example

#

A form attribute on a <select> element.
Although outside the form, the dropdown is included during form submission.

Product Details


<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>

Using form

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.


Syntax

<select form="form-id">

Values

#

Value Description
form-id The id of the form.

Browser support

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

You may also like

 Back to <select>
Guides