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

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

Web Technologies e.g. SASS, LESS and Doctrine

E-Commerce : Platforms

1-Machine Learning : Start...

Linear Algebra : Non-Linear By the Way!

Marketing

A Survey of the Final Year University Students

Data Engineering Tools

How to take notes in Freshman Year ?

LINUX Kernel