0
請幫我知道這個代碼有什麼問題! 我搜索很多,但它看起來像我有沒有錯誤,甚至,它的作品,當我嘗試少投入jquery驗證不起作用不知道爲什麼
這是腳本代碼
$(document).ready(function(){
$("#patient-form").validate({
rules:{
pfname:{
required:true
},
plname:{
required:true
},
pemail:{
required:true,
email:true
},
ppass:{
required:true,
minLength:6
},
pcpass:{
minLength:6,
equalTo:"#ppass"
},
pcity:{
required:true
},
pbirthdate:{
required:true,
dateFormat: true
}
}
});
});
這是html代碼 我使用一些自舉類但肯定他們不是停止驗證的原因,我刪除了輸入文件和plname和pcity,它運行良好,我不知道它爲什麼不起作用。 我希望有人能幫助我,我需要這個,因爲我正在研究畢業項目,我會很感激。
<form id="patient-form" method="post" action="" enctype="multipart/form-data" class="form-horizontal">
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="pfname">First Name</label>
<div class="col-md-6 col-sm-9">
<input type="text" class="form-control sel" name="pfname" id="pfname" placeholder="Enter First Name">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="plname">Last Name</label>
<div class="col-md-6 col-sm-9">
<input type="text" class="form-control" name="plname" id="plname" placeholder="Enter Last Name">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="pemail">Email</label>
<div class="col-md-6 col-sm-9">
<input type="text" class="form-control" name="pemail" id="pemail" placeholder="Enter Email">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="ppass">Password</label>
<div class="col-md-6 col-sm-9">
<input type="password" class="form-control" name="ppass" id="ppass" placeholder="Enter Password">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="pcpass">Confirm Password</label>
<div class="col-md-6 col-sm-9">
<input type="password" class="form-control" name="pcpass" id="pcpass" placeholder="Re-enter Password">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="pcity">City</label>
<div class="col-md-6 col-sm-9">
<input type="text" class="form-control" name="pcity" id="pcity" placeholder="Enter Your City">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-md-offset-2 col-sm-3" for="pbirthdate">Birth Date</label>
<div class="col-md-6 col-sm-9 form-inline">
<input type="date" name="pbirthdate" id="pbirthdate" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-2 col-md-offset-2 col-sm-4 col-sm-offset-4 col-xs-4 col-xs-offset-4">
<input type="submit" class="form-control" value="Sign Up">
<input type="hidden" name="sign-up-check" value="1">
</div>
</div>
</form>
它工作正常。你拼寫了'minlength'規則錯誤。見:http://jsfiddle.net/psmdogsn/ – Sparky
謝謝你sooo多:) – cyco3dg