The easiest way to remove validation from fields is to add the disabled attribute to them.
var $div2 = $('div#2'); $div2.hide(); $('input, select, textarea', $div2).attr('disabled', 'disabled');
And they will not be verified. But this also leads to the fact that disabled fields should not be sent to the server. If you do not need these manually hidden fields to send to the server, the technique is good.
And another way is to manually add and remove all validation rules from an element using delete rules and add rules . This, of course, is more complicated, since you have to add and delete each rule, one for each input.
archil
source share