HTML <datalist> Tag
In this tutorial, we will learn about datalist tag in HTML with the help of examples.
<datalist> Tag
Datalist tag <datalist> is used to specify a list of pre-defined option for an <input> tag i.e. when the user input something then some options are appears (related to the first input value) which are predefined in <datalist> tag.
Note : <datalist> tag id attribute must be equal to the <input> tag list attribute to relate them with each other.
Syntax
<datalist>.....</datalist>
Example
<!DOCTYPE html>
<html>
<head>
<title>Datalist Tag</title>
</head>
<body>
<input list = "ProgrammingLanguage">
<datalist id = "ProgrammingLanguage">
<option value = "C">
<option value = "C++">
<option value = "Java">
<option value = "Python">
<option value = "Javascript">
</datalist>
</body>
</html>
Output
Global Attribute
Datalist Tag support all the global attributes of HTML.
Event Attribute
Datalist Tag support all the event attributes of HTML.
Next Tutorial
We hope that this tutorial helped you develop better understanding of the concept of datalist tag in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML dd
Tag.