How to use list attribute in HTML?

HTMLWeb DevelopmentFront End Technology

In HTML, we use the <datalist> element to specify a list of pre-defined options. This list is for an input element. The list attribute refers to this <datalist> element. HTML5 introduced the list attribute.

The list attribute refers to a <datalist> element that contains pre-defined options for an <input> element.


You can try to run the following code to learn how to use the list attribute in HTML.

<!DOCTYPE html>
      <title>HTML list attribute</title>
      <p>Type the tool name:</p>
      <input list = "tools" name = ”tool” />
      <datalist id = "tools">
         <option value = "Image Editor">
         <option value = "Whiteboard">
         <option value = "Image Optimizer">
         <option value = "Document Viewer">
Updated on 14-May-2020 10:23:42