Reputation: 19702
I'm trying to set some custom defaults for the jQuery validation plugin.
I've tried the following:
$.validate.settings.ignore = ":hidden";
and
$.validate.settings.errorPlacement = function (error, element) {
if (element.hasClass("removedTitle"))
error.insertAfter(element.next("img"));
else
error.insertAfter(element);
};
However, neither of these seem to make any difference. Is there a way to achieve this?
Upvotes: 3
Views: 6603
Reputation: 337646
Try:
$.validator.setDefaults({
ignore: ":hidden",
errorPlacement: function (error, element) {
if (element.hasClass("removedTitle"))
error.insertAfter(element.next("img"));
else
error.insertAfter(element);
}
});
Further reading: http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
Upvotes: 2