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.
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>
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.
<select name="text">
Value | Description |
---|---|
text | String value. Name of the select element. Required for form submission. |
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 |