I'm trying to use jQuery validate plugin to confirm my password entry.
但是,我不希望它成为必填字段.
Just IF a user wants to change the password, they would need to confirm it.
If not, both fields shouldn't be validated.
jQuery('.validatedForm').validate({
rules: {
password: {
required: true,
minlength: 5
},
password_confirm: {
required: true,
minlength: 5,
equalTo: "#password"
}
}
});
这是完美的工作方式,但同样,这两个字段都是必需的.
我想有这个可选的,以防有人只是想改变例如他们的邮箱或用户名,而不go 管密码.