HTML <select> (Selection List) Tag

❮ Previous Reference Next ❯

Example

<label for="lang">Choose your option:</label>

<select name="language" id="lang">
  <option value="HTML">HTML</option>
  <option value="CSS">CSS</option>
  <option value="JavaScript">JavaScript</option>
</select>

Meaning

The <select> element defines a selection list within a form. Depending on the form of the selection list, the control allows the user to select one or more list options.

Note: A <select> element must contain at least one <option> element.

Version: HTML 2, 3.2, 4, 4.01, 5


Standard Syntax

<select>
  <option>text</option>
</select>



Browser Support




Status







Attributes

Attribute Value Description
autocomplete autocomplete Providing a hint for a user agent's autocomplete feature.
autofocus autofocus Allows the author to indicate that a control is to be focused as soon as the page is loaded
disabled disabled If present, make the control non-interactive and to prevent its value from being submitted.
form formId Associate the select element with its form owner.
multiple multiple If the attribute is present, then the select element represents a control for selecting zero or more options from the list of options.
name uniqueName Represents the element’s name.
required required When specified, the user will be required to select a value before submitting the form.
size valid non-negative integer Gives the number of options to show to the user.

Global Attributes

The <select> element also supports the Global Attributes in HTML.


Event Attributes

The <select> element also supports the Event Attributes in HTML.


By Default CSS Value(s)

None.




Related Tags:

<button>, <datalist>, <fieldset>, <form>, <input>, <label>, <legend>, <meter>, <optgroup>, <option>, <output>, <progress> and <textarea>
❮ Previous Reference Next ❯