I have a custom rule:
jQuery.validator.addMethod("greaterThanStartPrice", function(value, element, param) {
return this.optional(element) || (parseFloat(value) > $(param).val());
}, "\"Reserve Price\" must be greater than \"Start Price\"");
to check that a value entered into input box b is greater than input box a. This rule works great however the form field it is applied to is dynamic so I also have:
$("#txtReservePrice").rules("remove");
to remove the rule. The rule is initiated:
$("#frmEditListingAuction").validate({
meta: "validate",
rules : {
txtReservePrice:{
greaterThanStartPrice:"#txtStartPrice",
}
}
});
I am having trouble re-adding the rule back on. I have tried:
$("#txtReservePrice").rules("add", "greaterThanStartPrice");
$("#txtStartPrice").rules("add", "greaterThanStartPrice");
but apart from that I am a little lost. Many thanks
Worked it out if anyone wants to know