HTML and CSS Reference
In-Depth Information
Name
datalist
Synopsis
<datalist> . . . </datalist>
Not in HTML 4.01
. Used with an
input
control set to the new
list
type, the
datalist
ele-
ment creates a drop-down menu of pre-defined suggestions (via the
option
element), provid-
ing an “auto-complete” function as the user types in the field (called a
combobox
). The differ-
ence between
datalist
and
select
is that the user does not need to select one of the sugges-
tions and can write anything in the field.
Usage
Categories:
Flow content, phrasing content
Permitted contexts:
Where phrasing content is expected
Permitted content:
Either phrasing content or zero or more
option
elements
Start/end tags:
Required/Required
Attributes
HTML5 Global Attributes
Example
<input type="text"
list=
"
flavors
">
<datalist id="flavors">