You are here: Reference > HTML > attributes > MULTIPLE (keygen, select)

MULTIPLE attribute (keygen, select)

Browser support:
Sets whether more than one item from a list can be selected.
The select element, or the selection list of the keygen element allows simple or multiple selection, depending on the state of the MULTIPLE attribute.
  • If multiple selection is allowed, the visual appearance of the selection list can only be a list box.
  • If only one selected element is allowed, the selection list may be a drop-down list or a list box. The default appearance is the drop-down list in that case.
You can set the count of the visible rows in a selection list with the size attribute.
If the value of the size attribute is greater than one, the appearance of the selection list is a list box.
In a non-empty drop-down list always exactly one selected element exists. If there is no element selected by default in a drop-down list, the first option will be selected.
In a single-selection list box the count of the selected items can be 0 (if the list box does not have a selected element by default) or 1.
In a multiple-selection list box the count of the selected items can be from 0 to the number of the items.
You can set the element(s) selected by default with the SELECTED attribute.
If you want to use the selection list in an form element and you want to submit data that belongs to the selection list with the form, see the page for the select element, you can find detailed technical information there.
JavaScript page for this attribute: multiple. You can find other example(s) there.

Possible values:

This attribute has no values.
Specifying the MULTIPLE attribute with an arbitrary value has the same effect as specifying it with no value.
For example, all of the following declarations have the same effect: multiple, multiple="true", multiple="false", multiple="on", multiple="multiple".
Although Boolean attributes may be used with no value in HTML, for XHTML compatibility, always use the MULTIPLE attribute in the following format: multiple="multiple".

Example HTML code 1:

This example illustrates the use of the MULTIPLE attribute:
Hold down the CTRL key to select more than one element.<br /><br />
<select id="mySelect" multiple="multiple" size="7">
    <option selected="selected" />Component_1</option>
    <option />Component_2</option>
    <option />Component_3</option>
    <option />Component_4</option>
    <option />Component_5</option>
    <option />Component_6</option>
    <option />Component_7</option>
</select>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content