HTML | <input> list Attribute

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


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


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.