How to Turn Off Form Autocompletion in HTML?


The autocomplete attribute is used with form element to set the autocomplete feature on or off. If the autocomplete feature is on, the browser will automatically show values, based on what users entered before in the field. If the autocomplete feature is off, the browser won’t automatically show values, based on what users entered before in the field.

The following are the attribute values −

S. No
Attribute Value
Description
1on
This is the default value. Browser automatically complete values based on what users entered before.
2off
Browser won’t complete values based on what users entered before. Users have to type the value.

Let’s see how to turn off autocompletion in HTML:

Example

You can try to run the following code to learn how to set autocomplete off. For autocomplete off value, web browser won’t complete values based on what users entered before.

<!DOCTYPE html>
<html>
   <head>
      <title> HTML autocomplete attribute</title>
   </head>
   <body>
      <form action = "" method = "get" autocomplete="off">
         Details:<br><br>
         Student Name<br><input type = "name" name = "sname"><br>
         Training week<br><input type = "week" name = "week"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>

Vikyath Ram
Vikyath Ram

A born rival

Updated on: 15-Jun-2020

58 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements