Javascript DOM HTML Input Search autocomplete Property get

Introduction

Return the state of auto completion:

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

Click the button to find out the search field autocomplete status.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Search: <input type="search" id="mySearch" name="search" autocomplete="on">
  <input type="submit">
</form>//from   w  w w  .j  av a2s .  c  om

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

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

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

</body>
</html>



PreviousNext

Related