Question...


There was a question related to <datalist> regarding HTML 5.

Question: Is it necessary to have <input> tag for <datalist> usage or The search bar in the output is due to the <input> tag?

Answer: Yes, the <input> tag is a must before <datalist> tag, this is because if you don't use <input> tag, then there will be no data list in the output.

Reference code: (WITHOUT INPUT TAG)


<!DOCTYPE html>
<html><head><title></title></head>
<body>
<form action="" method="">
<datalist id="list">
<option value="a">
<option value="b">
<option value="c">
<option value="d">
</datalist>
</form>
</body>
</html>

Output:
Nothing in the output _ blank
Do you see anything in the output ? No, right?

Now let us put input tag, like this:

<!DOCTYPE html>
<html><head><title></title></head>
<body>
<form >
<input list="list">
<datalist id="list">
<option value="a">
<option value="b">
<option value="c">
<option value="d">
</datalist>
</form>
</body>
</html>


Now the output:

when you click the arrow, you will get something like:







Comments

Popular posts from this blog

Relational Data Model

An Interview with Pakistani Data Scientist : Dr. Zeeshan Ul Hassan Usmani

Data Engineering Tools

Applications of Data Engineering

Five People to Follow on Social Media

Data Science : The Fusion Reaction

Elasticsearch and Redis : NoSql

Web Scraping : Urdu News