A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/html/elements/select below:

select · WebPlatform Docs

select 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
Attributes Internationalization

Internationalization topics related to the select element:

Examples

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>

This JavaScript example adds a new option to the end of the SELECT list created above. The Option constructor can also be used in JavaScript.

var option = document.createElement("OPTION");
option.text="Ferrari";
option.value="4";
document.getElementById("select-element").add(option);
Notes

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 background, border, or 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 background-image: none.

Related specifications
HTML 5.1
W3C Working Draft
HTML 5
W3C Recommendation
HTML 4.01
W3C Recommendation
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4