本文介绍了忽略所有隐藏的div,但忽略jQuery验证中的所有div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在表单中使用jQuery验证 http://jqueryvalidation.org/documentation/
I am using jQuery validation in my formhttp://jqueryvalidation.org/documentation/
我想将验证添加到我的所有字段中,但是我想忽略具有类my_item
的隐藏的div
.
I want to add the validation to all my fields but I want to ignore the hidden div
's that have the class my_item
.
这是我的jQuery:
So here is my jQuery:
$("#myform").validate({
ignore: ":hidden"
});
如何从这种忽略情况中排除具有类my_item
的div.所以像$(":hidden").not(.my_item)
.
How is it possible to exclude from this ignore case, the divs that have the class my_item
. So something like $(":hidden").not(.my_item)
.
推荐答案
您可以使用 :not()
选择器:
ignore: ":hidden:not(.my_item)"
这篇关于忽略所有隐藏的div,但忽略jQuery验证中的所有div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!