Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

HTML Datalist Tag


The HTML <datalist> tag is is used to provide an auto complete feature on form element. It provides a list of predefined options to the users to select data.

The datalist tag is introduced in HTML5.

The <datalist> tag should be used with an <input< element that contains a “list” attribute. The value of “list” attribute is linked with the datalist id.

The HTML datalist tag supports global and event attributes also.


HTML datalist tag example

Let’s see the simple example of HTML5 datalist tag. If you press A, it will show a list of cricketers starting with A letter.

  1. <label>
  2.  Enter your favorite cricket player: Press any character<br />
  3.  <input type=“text” id=“favCktPlayer” list=“CktPlayers”>
  4.  <datalist id=“CktPlayers”>
  5.  <option value=“Sachin Tendulkar”>
  6.  <option value=“Brian Lara”>
  7.  <option value=“Jacques Kallis”>
  8.  <option value=“Ricky Ponting”>
  9.  <option value=“Rahul Dravid”>
  10.  <option value=“Shane Warne”>
  11.  <option value=“Rohit Sharma”>
  12.  <option value=“Donald Bradman”>
  13.  <option value=“Saurav Ganguly “>
  14.  <option value=“AB diVilliers”>
  15.  <option value=“Mahendra Singh Dhoni”>
  16.  <option value=“Adam Gilchrist”>
  17.  </datalist>
  18. </label>

Test it Now

Output:


Supporting Browsers

Element chrome_browser Chrome ie_browser IE firefox_browser Firefox opera_browser Opera safari_browser Safari
<datalist> Yes Yes Yes Yes Yes

Comments

comments