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

The multiple attribute on a <select> tag specifies that multiple items can be selected.

With this attribute, the control appears like a scrollable list, rather than a dropdown.

Example

#

A multiple attribute on a <select> tag.
Multiple cities can be selected with a Ctrl-click or Shift-click key combination.


Notice that instead of a dropdown, the select appears in list form.

<form action="/tutorial/fileupload.html">
  <select multiple style="height:125px;" name="cities">
    <option value="paris">Paris</option>
    <option value="london">London</option>
    <option value="athens">Athens</option>
    <option value="madrid">Madrid</option>
    <option value="berlin">Berlin</option>
  </select><br />

  <input type="submit">
</form>

Using multiple

A <select> element with a multiple attribute accepts multiple selections.

With this attribute present, users can select one or more items.

Multiple items are selected with Ctrl-click or Shift-click key combinations.

Ctrl-click adds individual items, Shift-click adds a range of items.

Tip: With multiple items selected, the client sends multiple name/value pairs to the server with the same name. With server frameworks like ASP.NET, PHP, or Ruby you will need to add square brackets [] at the end of the name. The server will then place the item values in an array by that name.


Syntax

<select multiple>

Browser support

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