Javascript DOM HTML Input Email autocomplete Property get

Introduction

Get the state of auto completion:

var x = document.getElementById("myEmail").autocomplete;

Click button to find out whether the email field has autocomplete set to "on" or "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  va2  s  .c  om*/
<button onclick="myFunction()">Test</button>

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

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

</body>
</html>



PreviousNext

Related