jquery.validate.unobtrusive 不适用于 Firefox/Chrome
对于 MVC 3.0 -动态内容的客户端验证在 IE 中运行良好,具有以下行。
$.validator.unobtrusive.parse()
但在 firefox/chrome 下就不是这样了。请提出任何解决方法。
For MVC 3.0 -Client Validation on dynamic content is works fine in IE with below line.
$.validator.unobtrusive.parse()
But this is not the case when firefox / chrome. Please suggest any workaround.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎没有向解析函数传递任何参数。您需要向其传递一个选择器,该选择器将包含通过 AJAX 添加的所有新元素。在最坏的情况下:
但最好指定一个容器:
或者:
还有一个问题。如果您不使用 AJAX 刷新包含新添加元素的
You don't seem to be passing any argument to the parse function. You need to pass it a selector that will contain all the new elements that were added with AJAX. In the worst case:
But it would be better to specify a container:
or:
Also there's a gotcha. If you don't refresh the
<form>
element that contains the newly added elements with AJAX, i.e. the form tag is not part of the partial, you will need to first remove previous validation rules that were associated with this form or the$.validator.unobtrusive.parse
method won't do anything: