Javascript DOM HTML Input Text autocomplete Property get

Introduction

Return the state of auto completion:

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

Click the button to find out whether the text field has autocomplete set to "on" or "off".

View in separate window

<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
  Name: <input type="text" id="myText" name="fname" autocomplete="on">
  <input type="submit">
</form>// w w  w  .j  a  v a 2 s . c o  m
<button onclick="myFunction()">Test</button>

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

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

</body>
</html>



PreviousNext

Related