让 jquery.validate {ignore: } 适用于字段集内容
我正在使用表单的 jQuery.validate() 插件。但是,表单包含一个字段集(它是隐藏的,并用作向表单添加行的模板),我不想对其进行验证。该字段集将被命名为类似于 organization_contacts_tmpl_33
的名称,其中不变量是 _tmpl_
部分。我已经尝试过:
$('#myform').validate({
debug: true,
ignore: '[id*="_tmpl_"] input'
});
我什至将字段集中的字段重命名为以 tmpl_ 开头,并尝试过:(
$('#myform').validate({
debug: true,
ignore: '[id^="tmpl_"]'
});
及其多种变体)但无济于事。有什么想法吗?
I'm using the jQuery.validate() plugin for a form. However the form contains a fieldset (which is hidden, and used as a template for adding rows to the form) which I don't want to be validated. The fieldset will be named something like organisation_contacts_tmpl_33
with the invariant being the _tmpl_
part. I've tried:
$('#myform').validate({
debug: true,
ignore: '[id*="_tmpl_"] input'
});
I've even renamed the fields inside the fieldset to start with tmpl_
and tried:
$('#myform').validate({
debug: true,
ignore: '[id^="tmpl_"]'
});
(and multiple variations thereof) but to no avail . Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不忽略隐藏的元素呢?
Why don't you just ignore hidden elements?
它只是一个 jQuery 选择器,它希望看到 文档
这应该可以工作。 。
its just a jQuery selector that it expects see the documentation
this should work...