2012-09-18 2 views
0

내 암호가 다른 것과 동일한 지 확인하려고합니다. 시스템은 암호가 동일하지 않은 오류로 계속 표시합니다.jQuery.validate.js equalTo가 작동하지 않습니다.

내 코드를 게시하자

<div class="fieldWrapper"> 
       <label for="password" id="id_password">Password: </label> 
       <input id="id_password" type="password" placeholder="Password" name="password" maxlength="128" class="valid"> 
      </div> 

<div class="fieldWrapper"> 
       <label for="password_verification">Confirm:</label> 
       <input id="id_password_verification" type="password" placeholder="Confirm" name="password_verification" maxlength="128"> 
      </div> 

$(document).ready(function() 
{ 
    $("#signup-form").validate({ 
    rules: { 
     password: { 
      required: true, 
      minlength: 5 
     }, 

     password_verification: { 
      required : true, 
      equalTo: "#id_password" 
     } 
    }, 
    messages: { 
     password: { 
      required: "Please provide a password", 
      minlength: "Your password must be at least 5 characters long" 
     }, 

     password_verification: { 
      required: "Please enter your password again", 
      equalTo: "Please enter the same password as above" 
     }, 
    }, 
    submitHandler: function(form) { 
     form.submit(); 
    } 
    }); 
}); 
사람이 어떤 단서가 있습니까

어디 내가 잘못 여기에 갈거야? 내 양식은 ID 가입 양식을 가지고 있습니다.

답변

2

당신은 당신의 HTML에 dupplicate id 있습니다

<label for="password" id="id_password">Password: </label>

label에서 id를 제거합니다.

+0

이 정보가 도움이됩니다. 감사 – Dunkey

관련 문제