Open In App

HTML DOM Input Date list Property

Last Updated : 31 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax:

dateObject.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 used to return the input date list property.  

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>Input Date list property in HTML</title>
    <style>       
        body
        {
           text-align: center;
        }
    </style>
</head>
 
<body>
    <h1 style="color:green">GeeksforGeeks</h1>
    <h2>Input Date list property</h2>
    <br> Date Of Birth:
    <input type="date" id="Test_Date" list="dates_list">
    <datalist id="dates_list">
        <option value="2021-02-12"/>
        <option value="2022-11-11"/>
        <option value="1999-12-21"/>
        <option value="2022-11-01"/>
        <option value="1998-02-11"/>
    </datalist><br><br>
    <button ondblclick="My_Date()">Click Here!</button>
 
    <p id="test" style="font-size:20px"></p>
 
 
 
    <script>
        function My_Date()
        {
            var x =    document.getElementById("Test_Date").list.id;
            document.getElementById("test").innerHTML = x;
        }
    </script>
</body>


Output:

 

Supported Browsers:

  • Google Chrome 20
  • Edge 12
  • Mozilla Firefox 57
  • Opera 11
  • Safari 14.1


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads