HTML and CSS Reference
In-Depth Information
HTML5 adds support for this directly into the markup with the
<datalist> element. A datalist is a named list of options, similar to the
list of options in a <select> element, which can then be associated with
one or more <input> elements using the list attribute.
In this example, with a screenshot taken in Firefox, the input has been
associated with a <datalist> with the id value " browsers " . When a user
selects the input, the list of options pops up. The user can pick one of
the options using the cursor keys or type their own:
<input type="text" name="browser"
list="browsers">
<datalist id="browsers">
<option
value="Internet Explorer">
<option value="Firefox">
<option value="Safari">
<option value="Chrome">
<option value="Opera">
</datalist>
At the time of writing, Opera is the only browser to implement the
color input type and allow the <datalist> element to be attached to that.
This sets the default colors available on the initial drop-down:
<input type="color"
list="greyscale">
<datalist id="greyscale">
<option value="#000000">
<option value="#333333">
<option value="#666666">
<option value="#999999">
<option value="#cccccc">
</datalist>
<input type="color"
list="rainbow">
<datalist id="rainbow">
<option value="#FF0000">
<option value="#FFA500">
Search WWH ::




Custom Search