html tutorial - list Attribute in HTML - html5 - html code - html form

List attribute in html

Learn html - html tutorial - List attribute in html - html examples - html programs

  • The list attribute specifies pre-defined options for an <input> element.

Syntax for list attribute in HTML:

<input list="datalist_id">

Differences between HTML 4.01 and HTML5 for list attribute:

HTML 4.01

  • HTML4 does not support list attribute.


  • HTML5 supports list attribute.

Applies To:

Elements Attribute
<input> list

Attribute Values:

Value Description
datalist_id Specifies the id of the datalist to be bind.

Sample Coding for list Attribute in HTML:

Tryit<!DOCTYPE html>
          <title>Wikitechy list attribute</title>
            <input list="tutorials" >
            <datalist id="tutorials" >
            <option value="html">
            <option value="css">
            <option value="php">

Code Explanation for list Attribute in HTML:

 list Attribute Code Explanation

  1. The list attribute used to specify the option list from the datalist id as “tutorials”.
  2. The <datalist> tag has list options and it has the id value as “tutorials”.

Output for list Attribute in HTML:

 list Attribute Tag Output

  1. The output shows list options like a drop down-list for the text box.

Browser Support for list Attribute in HTML:

20.0 10.0 4.0 No 9.6

Related Searches to list Attribute in html