HTML <datalist> tag

HTML <datalist> tag : Definition

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

• The <datalist> tag is used to provide an "autocomplete" feature for <input> elements, which users will see a list of drop-down which are pre-defined options as the input data.

• The <datalist> tag provides a list of predefined options to the users to select the data among them.



<datalist> tag example :

<!DOCTYPE html>
<html>
<body>
<form action="#" method="">
  <label for="browser">Enter first letter of the months:</label>
  <input list="browsers" name="browser" id="browser">
  <datalist id="browsers">
    <option value="January">
    <option value="February">
    <option value="March">
    <option value="April">
    <option value="May">
    


    <option value="Jun">
    <option value="July">
    <option value="August">
    <option value="September">
    <option value="October">
    <option value="November">
    <option value="December">
  </datalist>
  <input type="submit">
</form>
<p><strong>Note:</strong> The datalist tag is not supported in Safari 12.0 (or earlier).</p>
</body>
</html>

OUTPUT :


	

The datalist element example

Note: The datalist tag is not supported in Safari 12.0 (or earlier).