I know from here that I can pass an ignore option in the jQuery.validate method like this...
$('form').validate({
ignore: ":hidden"
});
... which works fine, but I wanted to set the validator to ignore ":hidden" form fields by default... I've tried the following:
jQuery.validator.defaults.ignore.push(":hidden");
... but it doesn't work.
To hide the form fields I've wrapped them in a div and I hide the div; which by default has "display: none" applied.
Anyone have any ideas?
Edit: I've been wondering after a bit of a look in firebug, whether the "not()" method in jQuery is not meant to be able to take an array... which is what the jQuery.validator.defaults.ignore property is, or is it something else?
Edit 2 I've noticed that if I do this:
jQuery.validator.defaults.ignore = ":hidden";
it works... again, i think it might be that it is an array...
Results It seems that using the code in Edit 2 above is not unreasonable as when you assign 'ignore: ":hidden"' in the validate() method you are essentially doing the same things... What got me was that the item in the defaults is an array.