gpt4 book ai didi

jquery - HTML5 输入类型杀死 jQuery 验证

转载 作者:太空狗 更新时间:2023-10-29 14:10:15 25 4
gpt4 key购买 nike

对于定义了 HTML5 类型的元素,jQuery 验证插件会中断。

$(document).ready(function(){
$("#myform").validate()
});
...
<form id="myform">
<input id="email" email="true" />
</form>
...

将 html5 属性 type="email" 添加到输入中会导致验证失败。我想使用 type="email" 因为手机 use this attribute to display the proper keyboard layout by default .

同时实现手机友好键盘和 jquery 验证库的最佳方式是什么?

您可以查看问题的示例 here .

最佳答案

您也许可以合并 this pull request对于主干,如果你愿意维护你自己的插件版本(补丁非常小,粗略地看 at the code ,似乎是正确的做法,尽管它肯定需要测试)。

您也可以回退到只使用 the HTML5 required字段(可能由未启用 javascript 的客户端支持),但请参阅 this issue .

关于jquery - HTML5 输入类型杀死 jQuery 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6234044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com