Horje
What is the significance of adding autocomplete attribute in HTML Form ?

The HTML <form> autocomplete attribute is used to specify that the form has autocompleted on or off value.  When the autocomplete attribute is set to “on“, the browser will automatically complete the values based on which the user entered before. 

Syntax:  

<form autocomplete="on|off">

Attribute values:

  • on: It has a default value. When the autocomplete attribute is set to “on” the browser will automatically complete the values based on which the user entered before.
  • off: The user should have entered the values of each field for every use. The browser should not autocomplete entries.

Example 1: This example illustrates the use of the <form> autocomplete attribute set to “on”.

HTML

<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML Form autocomplete Attribute
    </title>
</head>
 
<body style="text-align:center">
 
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
 
    <h2>HTML form autocomplete Attribute</h2>
 
    <form action="#" method="post"
          id="users" autocomplete="on">
 
      <label for="username">
        Username:
      </label>
 
      <input type="text" name="username"
             id="Username">
        <br>
      <label for="password">
        Password:
      </label>
 
      <input type="password" name="password"
             id="password">
        <br>       
    </form>
</body>
</html>

Output:         

Example 2: This example illustrates the use of the <input> autocomplete attribute set to “off”.

HTML

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1 style="color:green;">Welcome to GeeksforGeeks</h1>
    <form id="formID">
        <input type="text" autocomplete="off"
              id="text_id" name="name">
        <input type="submit">
    </form>
</body>
</html>

Output:        




Reffered: https://www.geeksforgeeks.org


HTML

Related
HTML DOM Textarea type Property HTML DOM Textarea type Property
HTML nonce Attribute HTML nonce Attribute
HTML itemscope Attribute HTML itemscope Attribute
Which tag is used to display additional information when we click to open or close on demand in HTML ? Which tag is used to display additional information when we click to open or close on demand in HTML ?
HTML DOM Input Search select() Method HTML DOM Input Search select() Method

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
11