Skip to content
Related Articles

Related Articles

Improve Article

HTML | <input> list Attribute

  • Last Updated : 12 Jul, 2019
Geek Week

The HTML <input> list Attribute is used to identify a list of pre-defined options for an element to suggest the user.

Syntax:

<input list="datalist_id">

Attribute Values:

  • datalist_id: It is used to specify the Id of the datalist that will used to make a link up with the input element.

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>
      HTML Input list Attribute
  </title>
</head>
  
<body>
    <h1>
        GeeksForGeeks
    </h1>
    <h1 style="color:green">
      HTML Input list Attribute
  </h1>
  
    <form action="">
        <label>Your Cars Name: </label>
        <input list="cars">
        <datalist id="cars">
            <option value="BMW" />
            <option value="Bentley" />
            <option value="Mercedes" />
            <option value="Audi" />
            <option value="Volkswagen" />
        </datalist>
    </form>
</body>
  
</html>

Output:

Supported Browsers: The browsers supported by HTML <input> list Attribute are listed below:

  • Google Chrome 20.0
  • Internet Explorer 10.0
  • Firefox 4.0
  • Opera 9.6

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :