The list attribute on an <input> links that control to a <datalist> in the same document. Its value is the datalist’s id. The browser then shows those <option> values as suggestions.
Suggestions are not a closed set — users can still type other values. For a fixed choice only, use <select> instead.
Not deprecated.
Valid HTML. Support for list on text-like inputs is wide; datalist UI and some input types still vary by browser.
Accessibility note.
Datalist popups can be awkward for zoom, high contrast, and some screen readers. Do not rely on suggestions as the only way to complete a required field.
Two datalists, one input. Each list has its own id.
Update the link. Set the list attribute to the other datalist’s id (the IDL list property is read-only).
Clear stale text. Reset value so an old fruit does not linger under vegetables.
Same document only. The datalist must live in the same page as the input.
Edge Cases & Pitfalls
Most issues are wrong IDs, unsupported types, or treating datalist like select.
id
IDs must match exactly
A typo in list or id silently disables suggestions. Keep both in the same document.
scope
Not for password / checkbox / file
Per the HTML / MDN rules, list is ignored on hidden, password, checkbox, radio, file, and button inputs.
compare
Not a select replacement
Datalist suggests; select constrains. Use select when only listed values are allowed.
filter
Incompatible options are skipped
Options that do not fit the input type are left out of the suggestion set.
a11y
Popup UX varies
Zoom, high contrast, and screen readers may not treat the suggestion list like a normal listbox. Provide a clear <label> and validate on the server.
Compatibility
Browser Support
list is an HTML attribute on <input> in the browser. It is not a Node.js, Deno, or Bun API.
✓ Widely available on text · UI varies
list
list on text-like inputs is widely supported (Chrome 20+, Firefox 4+, Safari 12.1+, Edge 12+). Datalist presentation and range/color behavior still differ across browsers.
97%text + list (approx.)
Google Chrome20+
Full support
Mozilla Firefox4+
Full support
Apple Safari12.1+
Full support
Microsoft Edge12+
Full support
Opera15+
Full support
Samsung Internet4+
Full support
Internet Explorer10+
Supported
list on text inputsWidely supported
Bottom line: Safe for progressive suggestions. Always allow free text (or use select) and test the datalist UI on target browsers.
Remember
Key Takeaways
Role: connect <input> to a <datalist> by matching id.
Suggestions only: users may enter values outside the list.
Types: works on many inputs; not on password, checkbox, radio, file, or buttons.
vs select: use select when the value must be one of the options.
One line:list="id" wires an input to a datalist of optional suggestions — not a locked menu.
Frequently Asked Questions
On an input, list points to the id of a datalist in the same document. The browser offers those option values as suggestions while the user types or opens the control.
The input element. The matching datalist must have the same id as the list value. It is not used on select.
No. Values are suggestions, not a hard limit. Users can enter other values that still pass validation. Use select when the choice must be only from a fixed list.
Most types except hidden, password, checkbox, radio, file, and button types. Common uses are text, search, email, url, tel, number, date/time types, range, and color.
Give the datalist an id, then set list to that same id on the input — for example list="browsers" with <datalist id="browsers">.
Support for list on text inputs is wide, but datalist UI and some input types still vary by browser. Always test, and do not rely on it as the only way to choose a value.