Javascript examples for DOM HTML Element:Input Email field
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 |
---|---|
on | Default. The browser will fill values entered before |
off | The browser does not automatically fill the fields |
A String, representing the state of autocompletion
The following code shows how to Set autocomplete in an email field to off:
<!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>