Forms & Inputs

HTML <datalist> Tag

The <datalist> tag specifies a list of pre-defined options for an <input> element.

Definition and Usage

The <datalist> tag specifies a list of pre-defined options for an <input> element.

Standard Syntax:<datalist>...</datalist>

Interactive ExampleRunnable

HTML <datalist> Example

html
Try it Yourself
Live code demonstration for the <datalist> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<label for="browser">Choose your browser from the list:</label>

<input list="browsers" name="browser" id="browser">

<datalist id="browsers">

  <option value="Edge">

  <option value="Firefox">

  <option value="Chrome">

  <option value="Opera">

  <option value="Safari">

 </datalist>
</div>

Attributes for <datalist>

0 Supported Attributes

The <datalist> tag does not have tag-specific attributes. It supports all standard Global Attributes.

Global Attributes

The <datalist> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.

HTML Global Attributes Reference →
Event Attributes

The <datalist> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.

HTML Event Attributes Reference →

Browser Compatibility

ChromeEdgeFirefoxSafariOpera

More Tags in Forms & Inputs

View All 123Tags →