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

The name attribute on a <select> tag assigns a name to that select element.

This name is used during form submission and as a reference for other purposes.

Example

#

A <select> element with a name attribute.
The selected value of the dropdown is sent during form submission.


<form action="/tutorial/action.html">
  <select name="size">
    <option value="">-- Select Size --</option>
    <option value="small">Small</option>
    <option value="medium">Medium</option>
    <option value="large">Large</option>
  </select><br />

  <button type="submit">Submit</button>
</form>

Using name

The name attribute assigns a name to the select element.

Unlike id, the name does not have to be unique across the page.

This attribute is used as reference for JavaScript and for form data submission.

Note: Select elements must have a name to participate in form submission.


Syntax

<select name="text">

Values

#

Value Description
text String value. Name of the select element. Required for form submission.

Browser support

Here is when name 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