Ignore all hidden div but not one in jQuery validation

让人想犯罪 __ 提交于 2019-11-27 06:59:23

You can use the :not() selector:

ignore: ":hidden:not(.my_item)"
Dimitri van der Vliet

Accepted answer is perfectly fine but when you need some more control than the jQuery selector provides. You could pass a function that tests each element.

for example:

ignore: function (index, el) {
   var $el = $(el);

   if ($el.hasClass('always-validate')) {
       return false;
   }

   // Default behavior
   return $el.is(':hidden');
},
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!