Open In App

What is the use of the HTML datalist Element ?

The HTML <datalist> Element is used to provide a predefined list of options for user input within an <input> element. It enhances the user experience by offering suggestions or autocompletion based on the provided list.

The <datalist> in HTML offers selectable options for the <input> field, while <option> groups choices within a dropdown menu for better organization.

Syntax

<datalist id="fruitList">
<option value="Apple"></option>
<option value="Banana"></option>
<option value="Orange"></option>
<option value="Grapes"></option>
</datalist>

Features

Article Tags :