jquery validate, check difference between fields
Hi all,
I'm new to jQuery. I use the plugin validate in order to check values between two fields.
So I have two fields, and I want to check if the value of the first field is greater than the value of the seconde one.
But, I can't find into the documentation how to do that.
Following is my current JavaScript :
- $().ready(function() {
$(document.CorrespondancePPForm).validate({
rules: {
tpsRetenu1: {
required: true,
number: true,
min: 0,
max: $(document.CorrespondancePPForm.tpsRetenu2).val()
},
tpsRetenu2: {
required: true,
number: true,
min: $(document.CorrespondancePPForm.tpsRetenu1).val()
}
},
});
});
As you can see, I tried to do it by "min" and "max" rules.
Can anyone help me ?