Javascript DOM HTML Input Email autocomplete Property set

Introduction

Set autocomplete in an email field to off:

document.getElementById("myEmail").autocomplete = "off";

Click button to set autocomplete in the email field to "off".

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
E-mail: <input type="email" id="myEmail" name="email" autocomplete="on">
<input type="submit">
</form>/*from  w w w. j a  v a 2 s . c  o m*/
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("myEmail").autocomplete = "off";
  document.getElementById("demo").innerHTML = "autocomplete is now 'off'.";
}
</script>

</body>
</html>

The autocomplete property sets or gets the autocomplete attribute in a email field.

The autocomplete property accepts and returns a String type value.

Property Values

Value Description
onDefault. The browser will automatically complete values
off The browser does not automatically complete entries



PreviousNext

Related