Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <select> form Attribute

The form attribute on a <select> tag specifies the form the dropdown is associated with.

The select will be included during the form submission.

Example

#

A <select> element with a form attribute. 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>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides