🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

The Datalist Tag

Create native, lightweight autocomplete dropdowns that don't lock your users in.

datalist.html
<!-- Native Autocomplete -->
<input list="cars" />
<datalist id="cars">
<option value="Volvo">
<option value="BMW">
</datalist>
datalist.html
1 / 9
📋

Tutor:The <datalist> tag is a powerful element that provides an autocomplete feature for <input> elements. Unlike a select dropdown, users can still type their own value, but they see suggestions.


Datalist Mastery

Unlock nodes by learning the syntax.

Concept 1: The Input

Start with a standard text input. The key difference is adding the list attribute, which points to the list you will create later.

System Check

Which attribute is added to the <input> tag?


Community Holo-Net

Showcase Your Autocomplete

Built a cool search bar or filter using datalist? Share your code snippets.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

HTML Datalist: The Native Autocomplete

Author

Pascual Vila

Frontend Instructor.

The <datalist> element is one of the most underappreciated tags in HTML. It allows you to create a lightweight, native autocomplete feature without requiring complex JavaScript libraries.

Datalist vs. Select

With a standard <select> dropdown, the user is forced to choose one of the options you provide. With <datalist>, you are providing suggestions, but the user is free to type something else completely. It is a hybrid between a text input and a dropdown.

The Connection (List & ID)

The most common mistake developers make is forgetting to link the two elements. The <input> must have a list attribute, and that value must exactly match the id of the <datalist>.

Browser Support

Datalist is supported in all modern browsers. It provides a consistent OS-level UI for selecting options, which is often more accessible than custom JavaScript implementations.

Datalist Glossary

<datalist>
The container tag for the options. It is invisible by default and only appears when linked to an active input.
list attribute
An attribute placed on the <input> tag. It points to the ID of the datalist you want to use.
<option>
Defines an item in the list. In a datalist context, it usually only needs a value attribute.