English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <datalist> element contains a set of <option> elements, which represent the optional values for other form controls; The <datalist> tag is an HTML5element, which defines the suggested value list for the <input> tag. These suggested values will be displayed as a dropdown list in the input control, and the available options will be filtered when the user enters data into the input control. This tag is also commonly referred to as <datalist&
Below is an <input> element, where the possible values are described in the <datalist>:
!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML5 datalist tag usage (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> label for="tutorial_choice">Tutorials: </label> input list="tutorial_types" name="tutorial_choice" id="tutorial_choice"> datalist id="tutorial_types"> <option value="HTML"> <option value="CSS"> <option value="SQL"> </datalist> </body> </html>Test and see ‹/›
In this HTML5In the document example, we used the <datalist> tag to create a suggested value list for the <input> tag. It is recommended to use3values (HTML, CSS, and SQL), which will be displayed as a dropdown list for user selection.
The <datalist> tag has basic support in the following browsers:
IEFirefoxOperaChromeSafari
The HTML <datalist> element is located within the <body> tag. The <datalist> tag is usually located within the <form> tag.
The <datalist> tag contains a set of <option> tags that provide possible values for the associated <input> tag.
The <datalist> tag specifies the list of possible options for the <input> element.
The <datalist> tag is used to provide the "auto-complete" feature for the <input> element. Users can see a dropdown list with pre-defined options, which will be used as input data for the user.
Please use the list attribute of the <input> element to bind the <datalist> element.
<datalist> tag is a part of HTML5 and the new tags.
Support for <datalist> tag Global attributes of HTML.
Support for <datalist> tag HTML event attributes.