Introduction

Today, in this article let's learn one more concept in HTML5.
In this article, we will learn how to create a DataList in HTML 5 using the Datalist tag.

What is Datalist Tag in Html 5?

In simple terms, "It enables to perform auto-completion with specific HTML targeted control".
Let's see how we can create and use a Datalist in HTML 5.
Step 1: The Complete Code of Datalist.html looks like this:
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
  6. Remove this if you use the .htaccess -->
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  8. <title>templates</title>
  9. <meta name="description" content="" />
  10. <meta name="author" content="Vijay" />
  11. <meta name="viewport" content="width=device-width; initial-scale=1.0" />
  12. <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
  13. <link rel="shortcut icon" href="/favicon.ico" temp_href="/favicon.ico" />
  14. <link rel="apple-touch-icon" href="/apple-touch-icon.png" temp_href="/apple-touch-icon.png" />
  15. </head>
  16. <body>
  17. <div style="font-family: Verdana; font-size: 22">
  18. <header>
  19. <h1 align="center" style="color: gray">DataList Tag - Html 5</h1>
  20. </header>
  21. <div>
  22. <p> Question Arises: <b>What is DataList Tag</b></p>
  23. <p style="color: blue">In Simple Terms "It Provides an AutoComplete Feature with a specific Html Control"</p><br>
  24. <ul style="text-align: center">It is Supported in:
  25. <li style="color: red">Mozilla FireFox</li>
  26. <li style="color: red">Opera</li>
  27. </ul>
  28. </div>
  29. <div align="center">
  30. <fieldset><legend>Datalist - HTML 5</legend>
  31. Please Enter Some Values: <input type="text" list="datalist1" required="required" />
  32. <input type="submit" />
  33. <datalist id="datalist1">
  34. <select>
  35. <option value="France">France</option>
  36. <option value="United Kingdom">United Kingdom</option>
  37. <option value="China">China</option>
  38. <option value="USA">USA</option>
  39. <option value="India">India</option>
  40. </select>
  41. </datalist>
  42. </fieldset>
  43. </div>
  44. <footer>
  45. <p align="center" style="color: silver">© Copyright by Vijay Prativadi</p>
  46. </footer>
  47. </div>
  48. </body>
  49. </html>
Step 2: The Output of the Application looks like this:
Clipboard02.jpg



I hope you found this article useful.
I look forward to seeing your comments and feedback.
Thanks!