Home > DeveloperSection > Beginner > HTML5 datalist element

HTML5 datalist element

0 Comment(s)
 4553  View(s)
Rate this:

HTML5 datalist element

In HTML5 <datalist>element can be used in conjunction with an <input> element that contains a list of attribute. We create list with <option>element inside in <datalist>element. The list attribute is linked to the <datalist> element by the <datalist>element id. The datalist element specifies a list of option for an input field. To bind a datalist to an input field, let the list attribute of the input field refer to the id of the datalist. This will work as autocomplete textbox in html.



    Enter your favorite Crickter

    <input type="text" id="Cricktername" list="name">

    <datalist id="name">

      <option value="Sachin Tendulkar" />

      <option value="Virender Shewag" />

      <option value="M S Dhoni" />

      <option value="Yuvraj Singh" />

      <option value="Suresh Raina" />

      <option value="Yusuf Pathan" />



HTML5 datalist element

Don't want to miss updates? Please click the below button!

Follow MindStick