Javascript DOM HTML Input URL autocomplete Property get

Introduction

Return the state of auto completion:

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

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

elements with type="url" are not supported in Safari.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Homepage: <input type="url" id="myURL" name="website" 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("myURL").autocomplete;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related