Skip to content
Related Articles

Related Articles

HTML | DOM Input Date autocomplete Property

View Discussion
Improve Article
Save Article
  • Last Updated : 27 May, 2021

The Input Date autocomplete property in HTML DOM is used to set or return the value of autocomplete attribute of an Input Date field. The autocomplete attribute is used to specify whether the autocomplete attribute has an “on” or “off” value. When the autocomplete attribute is set to on, the browser will automatically complete the values based on which the user entered before.
Syntax: 
 

  • It returns the Input Date autocomplete property. 
DateObject.autocomplete
  • It is used to set the Input Date autocomplete property. 
DateObject.autocomplete = "on|off" 

Property Values: It contains two values which are listed below: 

  • on: It is the default value. It automatically completes the values. 
  • off: It defines that the user should fill the values with the URL input field. It does not automatically complete the values.

Return Value: It returns a string value that represents the state of autocomplete.
Example 1: This example returns the Input Date autocomplete property. 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Date autocomplete Property
    </title>
</head>
 
<body style="text-align:center;">
 
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
     
    <h2 style="font-family: Impact;">
        Input Date autocomplete Property
    </h2>
    <br>
 
    <input type="date" id="test_Date" autocomplete="on">
 
 
    <button ondblclick="My_Date()">Check</button>
 
    <p id="test"></p>
  
 
    <script>
        function My_Date() {
            var d = document.getElementById(
                        "test_Date").autocomplete;
             
            document.getElementById("test").innerHTML
                        = d;
        }
    </script>
 
</body>
 
</html>                               

Output: 
 

  • Before Clicking the Button: 
     

  • After Clicking the Button: 
     

Example 2: This example set the Input Date autocomplete property. 
 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Date autocomplete Property
    </title>
</head>
 
<body style="text-align:center;">
 
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
     
    <h2 style="font-family: Impact;">
        Input Date autocomplete Property
    </h2>
    <br>
 
    <input type="date" id="test_Date" autocomplete="on">
 
 
    <button ondblclick="My_Date()">Check</button>
 
    <p id="test"></p>
  
 
    <script>
        function My_Date() {
            var d = document.getElementById(
                    "test_Date").autocomplete = "off";
             
            document.getElementById("test").innerHTML
                    = "The value was changed to " + d;
        }
    </script>
</body>
 
</html>              

Output: 
 

  • Before Clicking the Button: 
     

  • After Clicking the Button: 

 

Supported Browsers: The browsers supported by HTML DOM Input Date autocomplete Property are listed below: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!