Unreadable text using setCustomValidity on passwor

2019-06-27 17:10发布

If I set an error message using setCustomValidity on an html5 form password field, it pops up as bubbles or stars, just like the password field itself, resulting in an unreadable message.

Here's a jsfiddle for demonstrate what I mean: http://jsfiddle.net/LcfuQ/1/

This works in Firefox 4, but I get this strange behavior using Google Chrome. Anyone know of a workaround, or some way to fix this?

EDIT: This has been fixed in version 12+

2条回答
Evening l夕情丶
2楼-- · 2019-06-27 17:22

It's a WebKit bug with the -webkit-text-security CSS property, which can't be overridden. It's likely already been reported on the WebKit Bugzilla, but if it isn't you might want to report it.

查看更多
叼着烟拽天下
3楼-- · 2019-06-27 17:36

Seems like this is a problem with Chrome

When the input type="password", asterisks are shown in the place of characters even for HTML5.

See this fiddle in Chrome http://jsfiddle.net/idiotsden/RdwMw/ . It works in ff4.

The workaround is to use jquery tools. You can see the working tutorial here

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

查看更多
登录 后发表回答