Javascript DOM HTML Form autocomplete Property get

Introduction

Return the state of auto completion:

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

Click button to find out whether the form has autocomplete set to on or off.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form id="myForm" action="/action_page.php" autocomplete="on">
  First name:<input type="text" name="fname"><br>
  E-mail: <input type="email" name="email"><br>
  <input type="submit">
</form>/*from   w w w  .  j ava2 s.c o m*/
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

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

</body>
</html>



PreviousNext

Related