Name
datalist — HTML5
Synopsis
<datalist> . . . </datalist>
Used with an input
control
set to the new list
type, the
datalist
element creates a
drop-down menu of suggestions (via the option
element), providing an
“auto-complete” function as the user types in the field (also called a
combobox). The difference between datalist
and select
is that the user does not need to
select one of the suggestions and can write anything in the
field.
Notes
HTML5 only.
Start/End Tags
Required/Required
Attributes
HTML5 Global Attributes
Example
<input type="text" list="flavors"> <datalist id="flavors"> <option value="Vanilla"> <option value="Chocolate"> <option value="Mango"> </datalist>
Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.