Set autocomplete in a URL field to off:
document.getElementById("myURL").autocomplete = "off";
Click the button to set autocomplete in the URL field to "off".
elements with type="url" are not supported in Safari.
<!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 . java 2 s . c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myURL").autocomplete = "off"; document.getElementById("demo").innerHTML = "autocomplete is now 'off'."; } </script> </body> </html>
The autocomplete
property sets or gets the value of the autocomplete attribute in a URL field.
Property Values
Value | Description |
---|---|
on | Default. The browser will automatically complete values |
off | The browser does not automatically complete entries |
The autocomplete
returns a String representing the state of auto completion.