English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML: <input> list attribute

The list attribute refers to a <datalist> element that contains predefined options for the <input> element, and the list attribute is an HTML5of the new attribute in.

 HTML <input> tag

Online Examples

An <input> element with predefined values in a <datalist>:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<input> list 属性 - 基础教程网(oldtoolbag.com)</title>
<body>
<form action="action_page.php" method="get">
  <input list="languages" name="language">
  <datalist id="languages">
    <option value="Golang">
    <option value="C#">
    <option value="C++">
    <option value="PHP">
    <option value="Java">
  </datalist>
  <input type="submit">
</form>
</body>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 10, Firefox, Opera, and Chrome support the list attribute.

Note:Safari or Internet Explorer 9 and earlier versions do not support the list attribute of the <input> tag.

Definition and Usage

list attribute reference <datalist> element that contains predefined options for the <input> element.

HTML 4.01 and HTML5difference between

The list attribute is an HTML5 of the new attribute in.

Syntax

<input list="datalist_id">

Attribute Value

ValueDescription
datalist_idSpecifies the id of the datalist associated with the <input> element.
 HTML <input> tag