Good day. Help set Validate plugin to update user profile.
There are two input fields, "new password" and "repeat new password".
Need if they are both empty, it does not perform any checks. And if in the "Password" something entered, the password check for validity and equality of the second password.
I tried something like this, but this "if" does not work.
$.validator.setDefaults({ ignore: ":hidden:not(select)" });
$('#contact-form').validate({
rules: {
if(passord.lenght){
password: {
minlength: 6,
maxlength: 25,
required: true,
loginRegex: true
},
password_repeat: {
minlength: 6,
maxlength: 25,
required: true,
loginRegex: true,
equalTo: "#password"
}}
},
});
I was looking for the answer in similar topics, but not found.