Hum*_*art 8 html forms validation html5 webkit
Gecko允许您为requiredHTML表单字段设置错误消息x-moz-errormessage.
什么是WebKit的等价物?
Jon*_*sch 10
虽然上面链接的setCustomValidity()示例有效,但它没有考虑原生HTML5验证测试,而是提供自己的自定义测试.如果你不是喜欢用从HTML5的类型匹配/模式匹配,然后使用setCustomValidity()与oninvalid事件:
<input type="text" pattern="[a-zA-Z]+"
oninvalid="setCustomValidity('Custom Message')" />
Run Code Online (Sandbox Code Playgroud)
但请记住,这不会本地化为用户的浏览器语言,并且无论什么是无效的,也会显示(例如,如果required检查失败,它也会显示)
我几乎可以肯定没有,而且看起来不会发生:http://www.w3.org/Bugs/Public/show_bug.cgi? id= 10923。
您可能想查看一下setCustomValidity()。对我来说,它在 Chrome 中似乎工作得很好: http: //olav.dk/wf2/demo/validation.asp。
| 归档时间: |
|
| 查看次数: |
6794 次 |
| 最近记录: |