HTML <input> autocompleteAttribute

HTML input 标签参考手册HTML <input> Tag

Examples

An HTML form with autocomplete enabled (with one input field having autocomplete disabled):

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

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autocomplete attribute.

Tip:In some browsers, you may need to manually enable autocomplete (set it in the browser menu's "Settings").


Definition and Usage

The autocomplete attribute specifies whether an input field should have autocomplete enabled.

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

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


Differences Between HTML 4.01 and HTML5

The autocomplete attribute is new in HTML5.


Syntax

<input autocomplete="on|off">

Attribute Values

Value Description
on Default. Specifies that autocomplete is enabled.
off Specifies that autocomplete is disabled.


HTML input 标签参考手册HTML <input> Tag Other Extensions