HTML4 HTML5
The <select> tag creates a drop-down list of options in a form[cite: 3]. The user can select one (or multiple, if allowed) option defined via <option> tags[cite: 3].
Both opening and closing tags are mandatory[cite: 3].
Attributes:
name – field name used to identify submitted values server-side[cite: 3].disabled – disables interaction with the drop-down list[cite: 3].multiple – allows users to select multiple options simultaneously (usually requiring Ctrl/Cmd key)[cite: 3].required – forces option selection before form submission[cite: 3].size – defines the number of visible items (changes appearance from drop-down to static list)[cite: 3].class, id, and style are also used[cite: 3].In the example below, the <select> tag creates a drop-down menu to pick a city[cite: 3]:
Code:
The browser will interpret this code as follows: