浏览器表单默认填充行为之autocomplete属性

浏览器默认填充是前端很常见的一个问题,无论是注册页还是数据表单页,只要包含地址或是密码框就会调起浏览器的自动填充行为,其实autocomplete属性就可以解决大部分这些问题,只要在input标签里写上这个属性对应的功能名称即可,对应关系如下:

off: 用户必须手动填值,或者该页面提供了自己的自动补全方法。浏览器不对此字段自动填充。
on: 浏览器可以根据用户先前的填表情况对此字段自动填值。
name: 完整的姓名
honorific-prefix: Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "Mlle")
given-name :名
additional-name
family-name:姓
honorific-suffix: Suffix (e.g. "Jr.", "B.Sc.", "MBASW", "II")
nickname
email
username
new-password: 新密码(如创建帐号或更改密码时使用)
current-password
organization-title: Job title (e.g. "Software Engineer", "Senior Vice President", "Deputy Managing Director")
organization
street-address
address-line1, address-line2, address-line3, address-level4, address-level3, address-level2, address-level1
country
country-name
postal-code
cc-name: Full name as given on the payment instrument
cc-given-name
cc-additional-name
cc-family-name
cc-number: Code identifying the payment instrument (e.g. the credit card number)
cc-exp: Expiration date of the payment instrument
cc-exp-month
cc-exp-year
cc-csc: Security code for the payment instrument 
cc-type: Type of payment instrument (e.g. Visa)
transaction-currency
transaction-amount
language: Preferred language; Valid BCP 47 language tag
bday
bday-day
bday-month
bday-year
sex: Gender identity (e.g. Female, Fa'afafine); Free-form text, no newlines
tel
url: Home page or other Web page corresponding to the company, person, address, or contact information in the other fields associated with this field
photo: Photograph, icon, or other image corresponding to the company, person, address, or contact information in the other fields associated with this field

如是密码类型inputautocomplete设置为new-password

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值