Course Content
Ultimate HTML
Ultimate HTML
Datalist Element
The <datalist>
element in HTML is used to create a pre-defined list of options for an <input>
element. It allows the user to select an option from a list of pre-defined options, while also giving them the ability to enter their own value if they choose to. The list of predefined values is hidden up to the moment a user starts to type in the associated text field. We combine <datalist>
with id
attribute and <input>
with list
attribute.
index
index
index
Overall, the <datalist>
element can be a helpful way to provide a pre-defined list of options for users to select from, while still allowing them the flexibility to enter their own value if needed.
Everything was clear?