Home > Article > Web Front-end > What is the autocomplete attribute in HTML
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 d5fd7aea971a85678ba271703566ebfd 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】
##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 processautocomplete 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 judgmentExample:
<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>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. .
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!