How to use the <datalist> tag in HTML?

HTMLWeb DevelopmentFront End Technology

The HTML <datalist> tag specifies a set of options for <input> element. You need to also add an id. Use the <option>…<option> tag inside the <datalist…</datalist> tag.

Example

You can try to run the following code to use the <datalist> tag in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Datalist Tag</title>
   </head>

   <body>
      <p>Type the tool name:</p>
      <input list = "tools" />
      <datalist id = "tools">
         <option value = "Image Editor">
         <option value = "Whiteboard">
         <option value = "Image Optimizer">
         <option value = "Document Viewer">
      </datalist>
   </body>
</html>
raja
Published on 23-Jan-2018 06:58:17
Advertisements