Skip to content
Related Articles

Related Articles

HTML | DOM Input Email autocomplete Property
  • Difficulty Level : Basic
  • Last Updated : 06 Mar, 2019

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

Syntax:

  • It returns the Input Email autocomplete property.
    emailObject.autocomplete
  • It is used to set the Input Email autocomplete property.
    emailObject.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 of the email input field. It does not automatically complete the values.

Return Value: It returns a string value which represents the state of autocomplete attribute.

Example 1: This example illustrates how to return the Input Email autocomplete property.






<!DOCTYPE html> 
<html
      
<head
    <title
        HTML DOM Input Email autocomplete Property
    </title
</head>     
  
<body
  
    <h1> GeeksforGeeks</h1
  
    <h2>DOM Input Email autocomplete Property</h2
  
    E-mail: <input type="email" id="email"
            value="careers@geeksforgeeks.org" autocomplete="on"
  
    <button onclick="myGeeks()"
        Click Here! 
    </button
      
    <p id="GFG" style="font-size:25px;color:green;"></p
      
    <!-- Script to use Input Email autocomplete Property -->
    <script
        function myGeeks() { 
            var em = document.getElementById("email").autocomplete; 
            document.getElementById("GFG").innerHTML = em; 
        
    </script
</body
  
</html>                    

Output:
Before clicking on the Button:

After clicking on the Button:

example 2: This example illustrate how to set the Input Email autocomplete property.




<!DOCTYPE html> 
<html
      
<head
    <title
        HTML DOM Input Email autocomplete Property
    </title
</head>     
  
<body
  
    <h1> GeeksforGeeks</h1
  
    <h2>DOM Input Email autocomplete Property</h2
  
    E-mail: <input type="email" id="email"
            value="careers@geeksforgeeks.org" autocomplete="on"
  
    <button onclick="myGeeks()"
        Click Here! 
    </button
      
    <p id="GFG" style="font-size:25px;color:green;"></p
      
    <!-- Script to use Input Email autocomplete Property -->
    <script
        function myGeeks() { 
            var em = document.getElementById("email").autocomplete
                    = "off"; 
                      
            document.getElementById("GFG").innerHTML
                    = "The value of autocomplete attribute"
                      + " was changed to " + em; 
        
    </script
</body
  
</html>                    

Output:
Before clicking on the Button:

After clicking on the Button:

Supported Browsers: The browser supported by DOM input Email autocomplete property are listed below:

  • Google Chrome
  • Internet Explorer 10.0
  • Firefox
  • Opera
  • Safari
My Personal Notes arrow_drop_up
Recommended Articles
Page :