HTML Tag Reference - HTML tag <datalist>








The <datalist> tag creates a list of options for an <input> element to provide an "autocomplete" feature.

We can can bind datalist with input with list attribute from <input>.

Browser compatibility

<datalist> Yes Yes 10.0 No Yes

What's new in HTML5

The <datalist> tag is new in HTML5.

Global Attributes

The <datalist> tag supports the Global Attributes in HTML.

Event Attributes

The <datalist> tag supports the Event Attributes in HTML.





Default CSS Settings

datalist { 
    display: none;
}

Example

<!DOCTYPE html>
<html>
<body>
<!--   w w w .j  ava  2  s  .c  om-->
<form action="" method="get">
    <input list="myList" name="myInput">
    <datalist id="myList">
      <option value="A">
      <option value="B">
      <option value="C">
      <option value="D">
      <option value="E">
    </datalist>
    <input type="submit">
</form>



</body>
</html>

Click to view the demo