HTML <form> autocompleteAttribute

HTML form 标签参考手册HTML <form> tag

Examples

A form with autocomplete enabled:

<form action="demo_form.html" method="get" autocomplete="on"> First name:<input type="text" name="fname"><br> E-mail: <input type="email" name="email"><br> <input type="submit"> </form>

Try it Yourself »

Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Attribute
autocomplete Yes Yes 4.0 5.2 15.0

Definition and Usage

The autocomplete attribute specifies whether a form should have autocomplete enabled.

Autocomplete allows the browser to predict the input in a field. When the user starts typing in a field, the browser should display options to fill in the field, based on previously typed values.

To disable autocomplete for a form, you can set the autocomplete attribute to "off":

autocomplete="off"

Tip:autocomplete "on" applies to forms, while "off" applies to specific input fields, and vice versa.


Differences between HTML 4.01 and HTML5

The autocomplete attribute is a new attribute in HTML5.


Syntax

<form autocomplete="on|off">

Attribute Values

Value Description
on Default. Specifies that autocomplete is enabled. The browser will automatically complete values based on values previously entered by the user.
off Specifies that autocomplete is disabled. The user must enter values into each field every time, and the browser will not automatically complete input.


HTML form 标签参考手册HTML <form> tag Other extensions