select
select
This page has been flagged with the following issues:
High-level issues:
Summary
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.
Overview Table
| DOM Interface | HTMLSelectElement |
|---|
Examples
This example uses the SELECT element to create a drop-down list box.
<select name="Cats" size="1"> <option value="1">Calico <option value="2">Tortie <option value="3" selected>Siamese </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="oSelect" name="Cars" size="3" multiple> <option value="1" selected>BMW <option value="2">Porsche <option value="3" selected>Mercedes </select>
This example adds a new option to the end of the SELECT list created above. The new Option constructor can also be used in JScript.
<script language="JScript">
var oOption = document.createElement("OPTION");
oOption.text="Ferrari";
oOption.value="4";
oSelect.add(oOption);
</script>
Notes
Remarks
From Microsoft Internet Explorer 5 to Microsoft Internet Explorer 6, This element is a windowed control and does not support the z-index attribute or zIndex property. As of Windows Internet Explorer 7, this element is windowless and supports the z-index attribute and the zIndex property. The SELECT element does not require a strict doctype to enable windowless functionality.
Standards information
- Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5
- HTML 4.01 Specification, Section 17.6
HTML information
{
Compatibility
Desktop
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? |
Mobile
| Feature | Android | BlackBerry | Chrome for mobile | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile |
|---|---|---|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? | ? | ? | ? |
See also
Related pages (MSDN)
option
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]
This tool helps to make and review comments inline.
How to Use
insert instructions, with images, here