Skip to content
Related Articles

Related Articles

HTML DOM Input Color list Property

Improve Article
Save Article
  • Last Updated : 29 Aug, 2022
Improve Article
Save Article

The input color list property in HTML DOM is used to return a reference to the datalist element that contains an input color field.


Return Value: It returns a string value that represents the value of the id attribute of the datalist element.

Example: Below HTML code is used to return the input color list property.


<!DOCTYPE html>
    <title>HTML DOM Input Color list Property</title>
<body style="text-align:center;">
    <h1 style="color:green">
    <h2>HTML DOM Input Color list Property</h2>
        Select your favorite color:
        <input type="color" value="#009900"
            id="color" list="color_list">
    <datalist id="color_list">
        <option value="red" />
        <option value="green" />
        <option value="blue" />
        <option value="Brown" />
        <option value="yellow" />
    <button onclick="btnclick()">
        Click Here!
    <p id="paraID" style="font-size:20px;color:green;"></p>
    <!-- script to return list of  the input color  field-->
        function btnclick() {
            var x = document.getElementById("color");
            document.getElementById("paraID").innerHTML = x;



Supported Browsers:

  • Google Chrome 20
  • Edge 14
  • Firefox 29
  • Opera 12
  • Safari 12.1

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!