Input URL autocomplete Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input URL

Description

The autocomplete property sets or gets the autocomplete attribute in a URL field.

Set the autocomplete property with the following Values

Value Description
onDefault. The browser will automatically complete values based on values user entered before
off The browser does not automatically complete entries

Return Value

A String, representing the state of autocompletion

The following code shows how to Set autocomplete in a URL field to off:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#">
  Homepage: <input type="url" id="myURL" name="website" autocomplete="on">
  <input type="submit">
</form>//w  w  w  .  j  av a 2  s .c  o  m

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

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

<script>
function myFunction() {
    document.getElementById("myURL").autocomplete ='true' ;
    document.getElementById("demo").innerHTML = 'changed';
}
</script>

</body>
</html>

Related Tutorials