通过CSS停用自动填充功能 [英] Disable autocomplete via CSS

查看:222
本文介绍了通过CSS停用自动填充功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用CSS禁用表单元素(特别是文本字段)上的自动填充?

Is it possible to use CSS to disable autocomplete on a form element (specifically a textfield)?

我使用的标记库不允许自动填充元素

I use a tag library which does not permit the autocomplete element and I would like to disable autocomplete without using Javascript.

推荐答案

您可以使用生成的 id name 每次,这是不同的,所以浏览器不记得这个文本字段,并将无法建议一些值。

You can use a generated id and name everytime, which is different, so the browser cannot remember this text-field and will fail to suggest some values.

这至少是跨浏览器安全的替代方法,但我建议使用RobertsonM的答案( autocomplete =off code>)。

This is at least the cross browser safe alternative, but I would recommend to go with the answer from RobertsonM (autocomplete="off").

这篇关于通过CSS停用自动填充功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆