Skip to content
Related Articles

Related Articles

HTML DOM Input Time list Property

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

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

Syntax:

timeObject.list.id

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 time list property.  

HTML




<!DOCTYPE html>
<html>
<head>
    <title>DOM Input Time list Property</title>
</head>
<body>
    <center>
        <h1 style="color:green;">
            GeeksForGeeks
        </h1>
        <h2>DOM Input Time list Property</h2>
        <label for="uname" style="color:green">
            <b>Enter time</b>
        </label>
        <input type="time" id="gfg" list="time_list"
            placeholder="Enter time">
        <datalist id="time_list">
            <option value="09:55:32.55">
            <option value="22:15:35">
            <option value="16:00">
            <option value="12:00">
            <option value="11:00">
        </datalist><br><br>
        <br>
        <button type="button" onclick="geeks()">
            Click Here!
        </button>
        <p id="GFG" style="font-size:24px; color:green;">
        </p>
 
 
        <script>
            function geeks() {
                var link =
                    document.getElementById(
                        "gfg").list.id;
                document.getElementById(
                    "GFG").innerHTML = link;
            }
        </script>
    </center>
</body>
</html>


Output:

 

Supported Browsers:

  • Google Chrome 20 and above
  • Edge 12 and above
  • Firefox 57 and above
  • Opera 10 and above
  • Safari 14.1 and above

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!