The select element is used to create a drop-down list. Used with option tags inside the select element to define the available options in the list.
Allows the author to indicate that a control is to be focused as soon as the page is loaded
If present, make the control non-interactive and to prevent its value from being submitted.
form= the ID of a form element in the element’s owner
Associate the select element with its form owner.
By default, the select element is associated with its nearest ancestor form element.
If the attribute is present, then the select element represents a control for selecting zero or more options from the list of options. [Example B]
name= unique name
Represents the element’s name.
When specified, the user will be required to select a value before submitting the form.
size= valid non-negative intege
Gives the number of options to show to the user.
If the multiple attribute is present, then the size attribute’s default value is 4. If the multiple attribute is absent, then the size attribute’s default value is 1.
Internationalization topics related to the
This example uses the SELECT element to create a drop-down list box.
<select name="Cats" size="1"> <option value="1">Calico</option> <option value="2">Tortie</option> <option value="3" selected="">Siamese</option> </select>
This example uses the select element to create a multi-select list box by setting the SIZE and MULTIPLE attributes. To retrieve the selected options for a multi-select list box, iterate through the options collection and check to see where SELECTED is set to true.
<select id="select-element" name="cars" size="3" multiple=""> <option value="1" selected="">BMW</option> <option value="2">Porsche</option> <option value="3" selected="">Mercedes</option> </select>
var option = document.createElement("OPTION"); option.text="Ferrari"; option.value="4"; document.getElementById("select-element").add(option);
In the Browser app for Android 4.1 (and possibly later versions), there is a bug where the menu indicator triangle on the side of a select will not be displayed if a
border-radius style is applied to the select.
Firefox for Android, by default, sets a
background-image gradient on all
<select multiple> elements. This can be disabled using
Microsoft Developer Network: [Windows Internet Explorer API reference Article]