select

The <select> element allows user to select one or more values from list of values.

code result
<!-- single select -->
<label>select one number</label>
<select>
<option value="">
--Please choose number--
</option>
<option value="num1">number 1</option>
<option value="num2">number 2</option>
<option value="num3">number 3</option>
<option value="num4">number 4</option>
<option value="num5">number 5</option>
<option value="num6">number 6</option>
</select>
<!-- multiple select -->
<label>select one or more numbers</label><br>
<select multiple>
<option value="num1">number 1</option>
<option value="num2">number 2</option>
<option value="num3">number 3</option>
<option value="num4">number 4</option>
<option value="num5">number 5</option>
<option value="num6">number 6</option>
<option value="num7">number 7</option>
<option value="num8">number 8</option>
<option value="num9">number 9</option>
</select>

Selection ways depend from system.
Hold shift and use up/down arrows for select range of items. Hold ctrl or cmd (Mac OS) and make right click by mouse for select item.

<!-- grouping -->
<select>
<option value="">
--Please choose number--
</option>
<optgroup label="odd">
    <option value="num1">number 1</option>
    <option value="num3">number 3</option>
    <option value="num5">number 5</option>
    <option value="num7">number 7</option>
    <option value="num9">number 9</option>
</optgroup>
<optgroup label="even">
    <option value="num2">number 2</option>
    <option value="num4">number 4</option>
    <option value="num6">number 6</option>
    <option value="num8">number 8</option>
</optgroup>
</select>

attributes

attribute attribute
id, name Name of element.
required

A boolean attribute, indicates that an option with a non-empty string value must be selected.

value

Currently selected value.

multiple

A boolean attribute, indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time. Most browsers will show a scrolling list box when multiple is specified.

size

Specifies the number of rows in the list that should be visible at one time. Used when multiple is specified. Default values is 0.

disabled

A boolean attribute, indicates that the user cannot interact with the control.

disabled

A boolean attribute, indicates that the user cannot interact with the control.

form

Id of associated <form> element.