0
我有一個簡單的確認密碼jquery腳本,它根本不起作用... 表單被驗證每個長度的每個密碼。不能使用jquery確認密碼驗證
這是形式
<form action="${updatePassword}" method="post" class="form-signin" id="form-signin">
<div class="form-group">
<input type="password" id="password" name="password" placeholder="Enter new Password..." class="form-password form-control">
</div>
<div class="form-group">
<input type="password" name="confirmpassword" placeholder="Confirm Password..." class="form-password form-control" id="confirmpassword">
</div>
<button type="submit" class="btn" id="submit" name="submit> Reset password</button>
</form>
,這是腳本:
$(function() {
$("#submit").click(function() //input button click
{
$.validator.setDefaults({
debug: true,
success: "valid"
});
$("#form-signin").validate({
rules: {
password: {
required: true,
minlength: 5
},
confirmpassword: {
equalTo: "#password"
}
},
messages: {
password: {
required: "Inserire una password",
minlength: "La password deve contenere almeno 5 caratteri"
},
confirmpassword: {
equalTo: "Le due password devono coincidere"
}
}
});
});
});
它看起來相當線性...
試過......但沒有任何改變......看這裏https://jsfiddle.net/u82Lorp4/ – besmart
@besmart喜,我已經更新了代碼,現在正在工作。請檢查一下。 https://jsfiddle.net/u82Lorp4/1/其實你還沒有包含jQuery驗證插件。 –