在chrome中使用setCustomValidity密码字段的不可读文本

Unreadable text using setCustomValidity on password field in chrome

本文关键字:文本 字段 密码 chrome setCustomValidity      更新时间:2023-09-26

如果我在html5表单密码字段上使用setCustomValidity设置错误消息,它会弹出气泡或星星,就像密码字段本身一样,导致不可读的消息。

下面是一个示例来演示我的意思:http://jsfiddle.net/LcfuQ/1/

这在Firefox 4中工作,但我在使用Google Chrome时得到了这个奇怪的行为。有人知道解决这个问题的方法吗?

编辑:这已经在版本12+

修复

似乎这是Chrome的一个问题

当输入type="password"时,即使HTML5也会在字符处显示星号

看到这个小提琴在Chrome http://jsfiddle.net/idiotsden/RdwMw/。

解决方法是使用jquery工具。你可以在这里看到工作教程

http://flowplayer.org/tools/demos/validator/custom-validators.html

这是-webkit-text-security CSS属性的WebKit bug,不能被覆盖。它可能已经在WebKit Bugzilla上报告过了,但如果不是,你可能想要报告它。