What is the autocomplete attribute in HTML

清浅
Release: 2019-01-31 15:24:18
Original
22058 people have browsed it

The autocomplete attribute in HTML is used to implement the form auto-complete function. It is generally used in input elements to turn on or off the auto-complete function by setting the on or off value.

You can use autocomplete in HTML properties to implement auto-completion. It can generally be used in elements that take text or values ​​as input. autocomplete allows developers to specify the permissions user agents have to provide automatic help when filling in form field values, as well as provide guidance to the browser about the type of information expected in the field

[Recommended Course:HTML Tutorial

What is the autocomplete attribute in HTML

##autocomplete attribute introduction:

The autocomplete attribute indicates whether the input field should have autocomplete enabled.

Autocomplete allows the browser to predict input to a field. When a user starts typing in a field, the source of the suggested values ​​usually depends on the browser; usually from past values ​​entered by the user, but they may also come from pre-configured values. For example, browsers may let users save their names, addresses, phone numbers, and email addresses for autocomplete purposes. Perhaps the browser provides the ability to save encrypted credit card information to automatically complete after the verification process

autocomplete attribute usage:

off: refers to not allowing the browser Automatically enter or select the value for this field. A document or application may provide its own autocomplete functionality, or security concerns may require that a field's value not be entered automatically.

Note: In most modern browsers, setting autocomplete to "off" will not prevent the password manager from asking the user if they want to save username and password information, or from automatically filling in these values ​​in a site's login form .

on: Allow the browser to automatically complete input. No guidance is provided on the types of data expected in this field, so the browser can use its own judgment

Example:

<form action="#" method="get" autocomplete="on">
用户名:<input type="text" name="fname" /><br /><br />
密码: <input type="text" name="lname" autocomplete="off"/><br /><br />
<input type="submit" />
</form>
Copy after login

What is the autocomplete attribute in HTML

What is the autocomplete attribute in HTML

As can be seen from the above example, the username column has auto-complete turned on, so the previously entered value will be displayed when typing, while the password column will not be displayed if it is turned off. .


Summary: The above is the entire content of this article. I hope this article can help everyone learn to use the autocomplete attribute.

The above is the detailed content of What is the autocomplete attribute in HTML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template