Publish in HTML Tutorial el 23/05/2025 19:37
The <datalist> HTML element provides an "autocomplete" feature for <input> elements. It contains a set of <option> elements that represent predefined values for the input. Unlike <select>, users can still enter custom values while having suggestions available.
Key features:
Here's how to define a basic datalist:
Here's how the above code renders:
A simple color suggestion list with common color names:
Using datalist to suggest number values with a specific step:
Common email domain suggestions for user convenience:
Populating a datalist dynamically based on user input:
Loading datalist options from an external API:
The <datalist> element is supported in all modern browsers, including Chrome, Firefox, Edge, and Safari. However, some older browsers (like IE) may have limited or no support.
The <style> HTML element contains style information for a document, or part of a document. ...
The <strong> element is used to indicate that its content has strong importance, seriousnes...
The <span> element is an inline container used to mark up a part of a text or document. Unl...
The <source> element is used to specify multiple media resources for media elements like &l...
The <small> element is used to represent side-comments and small print, typically for discl...
HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...