奇怪的 jquery/jquery 验证器错误
如果我使用官方的 jquery lib,验证器(bassistance.de/query-plugins/jquery-plugin-validation)有一个恼人的错误,如果我点击提交一个空(必填)字段,验证器将显示错误,但如果我填写输入框脚本不会再次验证它(onkeypress 或 onblur 应该强制重新验证),只有当我再次单击提交时。
几个小时后,我意识到如果我在低音区使用库,错误就会消失。
复选框和列表适用于这两个版本的库。
If i using the official jquery lib the validator (bassistance.de/query-plugins/jquery-plugin-validation) have an annoying bug, if i hit the submit an empty (required) field the validator will display errors, but if i fill the input box the script doesnt validate it again (onkeypress or onblur should oblige to re-validate), only if i click submit again.
Hours later i realized if i using the lib at bassistance the bug dissappear.
Checkboxes and lists works well with both version of the lib.
Here you can check the form with the original lib.
(Hit submit, and write something to username field)
Here is the working example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并不是“官方”的,因为它是 jQuery 的一部分。这是一个第三方插件。
这并不神秘:在工作版本中,您使用的是相当旧的 jQuery 1.3.2。在工作版本中,您使用的是 jQuery 1.6。据推测该插件是针对旧版本的 jQuery 编写的。当您使用较新版本的 jQuery 时,该插件无法正常工作。
较新的 jQuery 库没有任何“问题”,但针对早期版本编写的第 3 方库中可能存在错误。
This isn't "official" in the sense that it's part of jQuery. It's a 3rd party plugin.
And there's no mystery here: In the working version, you're using jQuery 1.3.2, which is rather old. In the working version you're using jQuery 1.6. Presumably the plugin was written against this older version of jQuery. When you use a newer version of jQuery, the plugin isn't working correctly.
There is nothing "wrong" with the newer jQuery library, there is likely a bug in the 3rd party library which was written against an earlier version.