<select>: The SELECT Element
Last updated: 2026-10-13
<select>The SELECT Element
A drop-down control that lets the user pick one or more values from a preset list, usually submitted with a form.
| Category | Forms |
|---|---|
| Content Model | Flow content |
| Allowed Parents | Any element that accepts flow content |
| Content Tag | Yes — requires closing </select> tag |
| Status | Standard |
📝 Syntax
<select name="fruit">
<option value="apple">Apple</option>
<option value="banana">Banana</option>
</select>
⚙️ Attributes
This element supports the global attributes plus the following:
| Attribute | Value | Description |
|---|---|---|
name | Field name sent to the server. | |
multiple | Allow selecting multiple options. | |
required | A value must be selected before submit. | |
disabled | Disables the whole control. | |
size | Number of visible rows (a list box when > 1). | |
autofocus | Automatically focused on page load. | |
form | The id of the associated form (can live outside it). |
▶ Example
Edit the code below and see the live result in the playground:
🌐 Browser Support
| Browser | |||||
|---|---|---|---|---|---|
| <select> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported in all major browsers | |||||
Tip: Use multiple for multi-select; for free typing combine input + datalist.
❓ FAQ
QHow do I set the default selected option in a select?
AAdd the
selected attribute to the corresponding <option>: <option selected>Default</option>. Without it the first option is selected. You can also set select.value with JS to change the selection.QCan select allow multiple selections?
AYes, with the
multiple attribute: Ctrl/Cmd-click on desktop, though mobile support is awkward. A multi-select's name should be an array form (such as name='tags[]') so the backend receives multiple values. For long option lists, a checkbox group is friendlier.QWhat if a select has too many options?
AGroup them with
<optgroup> captions, or switch to <input list> plus <datalist> for a searchable suggestion field. The native select cannot be searched; beyond a few dozen options, use datalist or a third-party component.🏷️ Related Tags
💡 Related Cases
More case studies coming soon — check back later.