I am using jQuery Validate plugin to validate a \"configuration page\". I have a lot of inputs (like Name, Phone, Email...) and for last, \"change password\" section.
I
Try
var $cp = $('#current_password'),
$np = $('#new_password'),
$cnp = $('#confirm_new_password');
then
{
rules: {
current_password: {
required: function () {
return $np.val().length > 0 || $cnp.val().length > 0
}
},
new_password: {
required: function () {
return $cp.val().length > 0 || $cnp.val().length > 0
}
},
confirm_new_password: {
required: function () {
return $cp.val().length > 0 || $np.val().length > 0
}
}
},
}
Demo: Fiddle