I am using JQuery validate to validate that two fields are filled in, and that they match.
$("#resetFormDo").validate({
rules: {
password: {
required: true
},
passwordCopy: {
required: true,
equalTo: '#password'
},
},
messages: {
password: "Both fields required",
passwordCopy: "Both fields required"
},
});
Question: how to add a different error message for when fields don't match?
With it set like above, it just gives same error message for passwordCopy field if it's either empty or does not match other password field. Do I simply have to make the message more generic e.g. "Both fields required and must match"? Or, is there a way to separate them?