Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Input Email autocomplete Property
The HTML DOM Input Email autocomplete property sets/returns whether autocomplete is enabled or disabled. If enabled, it shows previously typed values.
Syntax
Following is the syntax −
- Returning value - on/off
inputEmailObject.autocomplete
- Setting autocomplete to value
inputEmailObject.autocomplete = value
Values
Here, “value” can be the following −
| value | Details |
|---|---|
| on | It defines that input has autocomplete enabled, it is also the default. |
| off | It defines that input autocomplete attribute is disabled. |
Example
Let us see an example of Input Email autocomplete property −
<!DOCTYPE html>
<html>
<head>
<title>Input Email autocomplete</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>Email-autocomplete</legend>
<label for="EmailSelect">User Email :
<input type="email" id="EmailSelect" placeholder="eg: xyz@abc.com" autocomplete="off" autofocus>
</label>
<input type="button" onclick="addAutocomplete()" value="Enable Suggestions">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputEmail = document.getElementById("EmailSelect");
divDisplay.textContent = 'Suggestions: '+inputEmail.autocomplete;
function addAutocomplete() {
inputEmail.autocomplete = 'on';
divDisplay.textContent = 'Suggestions: '+inputEmail.autocomplete;
}
</script>
</body>
</html>
Output
This will produce the following output −
Before clicking ’Enable Suggestions’ button −

After clicking ‘Enable Suggestions’ button −

Advertisements