Horje
HTML autocomplete Attribute in HTML

Definition and Usage

The autocomplete attribute specifies whether a form or an input field should have autocomplete on or off.

Autocomplete allows the browser to predict the value. When a user starts to type in a field, the browser should display options to fill in the field, based on earlier typed values.

Tip: It is possible to have autocomplete "on" for the form, and "off" for specific input fields, or vice versa.

Note: The autocomplete attribute works with the following <input> types: text, search, url, tel, email, password, datepickers, range, and color.


Applies to

The autocomplete attribute can be used on the following elements:

Elements Attribute
<form> autocomplete
<input> autocomplete

Browser Support

The autocomplete attribute has the following browser support for each element:

 


How to add HTML autocomplete Attribute in HTML Page

It is A form with autocomplete on.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The form autocomplete attribute</h1>

<p>Fill in and submit the form, then reload the page, start to fill in the form again - and see how autocomplete works.</p>
<p>Then, try to set autocomplete to "off".</p>

<form action="/action_page.php" method="get" autocomplete="on">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="email">Email:</label>
  <input type="text" id="email" name="email"><br><br>
  <input type="submit">
</form>

<p><b>Note:</b> The autocomplete attribute of the form element is not supported in Opera 12 and earlier versions.</p>

</body>
</html>

Output should be:

How to add HTML autocomplete Attribute in HTML Page

How to add An HTML form with autocomplete on (and off for one input field)

The autocomplete attribute

Fill in and submit the form, then reload the page to see how autocomplete works.

Notice that autocomplete is "on" for the form, but "off" for the e-mail field!

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The autocomplete attribute</h1>

<p>Fill in and submit the form, then reload the page to see how autocomplete works.</p>
<p>Notice that autocomplete is "on" for the form, but "off" for the e-mail field!</p>

<form action="/action_page.php" autocomplete="on">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <label for="email">Email:</label>
  <input type="email" id="email" name="email" autocomplete="off"><br><br>
  <input type="submit">
</form>

</body>
</html>

Output should be:

How to add An HTML form with autocomplete on (and off for one input field)




html autocomplete attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference