Input Email autocomplete Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Email field

Description

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

When autocomplete is set, the browser fills the values entered before.

Set the autocomplete property with the following Values

Value Description
onDefault. The browser will fill values entered before
off The browser does not automatically fill the fields

Return Value

A String, representing the state of autocompletion

The following code shows how to Set autocomplete in an email field to off:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#">
E-mail: <input type="email" id="myEmail" name="email" autocomplete="on">
<input type="submit">
</form>// ww  w .  ja  v  a 2 s . c  o m

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
    document.getElementById("myEmail").autocomplete = false;
    var x = document.getElementById("myEmail").autocomplete;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials