Displaying a drop down list along with text box.

Posted by Sunny.Sagar under HTML 5 category on | Points: 40 | Views : 1315
List items: <input type="text"list="listForMyList"name="myList" id="myList" />
<datalist id="listForMyList">
<option value="Option 1" >
<option value="Option 2" >
<option value="Option 3" >
<option value="Option 4" >
<option value="Option 5" >

In HTML5 to display a drop list, we can write datalist > option element. To attach a data list for the textbox, we
can set the list attribute of the textbox to the datalist id

Comments or Responses

Login to post response