In this illustration we will discuss use of <datalist> tag and its implementation. The <datalist> tag is used to define the list of selectable data as a drop down list of input values which contains only legal values. The drop down list is displays when user place focus on the text field . The option and the datalist should not be displayed. when user enter the value in the text field then option list displayed to the user with predefined values. The <datalist> tag is used with the <input> tag using "list" attribute.
| <datalist id="value">options </datalist> |
This is the new tag in html5 and have no element specific attribute. Here the id attribute is used to bind the datalist options with the list.
Example: Datalist_tag.html.
| <!DOCTYPE html> <html> <head> <title>Example of datalist Tag</title> </head> <body> Enter Your title: <input type="text" list="title" /> <datalist id="title"> <option value="Mr."> <option value="Mrs."> <option value="Km."> </datalist> </body> </html> |
Output:

Note: This code render by Opera9.5 browser . check availability of browser.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.