Html 5 Form List Attribute Tag

In the form list attribute tag indicates a data list for an input type field and which is used to options for a input field. The list attribute works with the text, url,search, telephone, date pickers,email,number, range, and color.

Syntax:

<form>
  <datalist>
   .... ...
  </datalist>
</form>

Example Code



<!DOCTYPE HTML>
Country : <input type="text" list="country_list"/>
<datalist id="country_list">
  <option label="India" value="India" />
  <option label="USA" value="Usa" />
</datalist>

Out Put :

Country :

In the above form if you type country name will display india, usa country name automatically in below of text box.





Content