What is the HTML list attribute?

The list attribute in HTMLHypertext Markup Language is used to show a list of pre-defined available options for an <input> element. It enables users to choose from the list of available options.

This attribute is used with the <input> element only.

Syntax


<input list="name">

Code

The basic HTML code to demonstrate the use of the list attribute is as follows:

In this example, we can see that we have made a form that has a data list. The user has to select from the multiple options that comprise the list.

Free Resources