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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With