0
我試圖做一個註冊頁面與引導和jQuery驗證。不幸的是,當我調用.validate()函數時,Opera會凍結約5秒,驗證不起作用。jquery驗證不工作,瀏覽器凍結
JS:
$(document).ready(function()
{
$("#register").validate({
rules:{
email:{required:true,email: true},
password:{required:true,minlength: 6}
},
messages:{
email:{
required:"Enter your email address",
email:"Enter valid email address"
},
password:{
required:"Enter your password",
minlength:"Password must be minimum 6 characters"
}
},
errorClass: "help-inline",
errorElement: "span",
highlight: function(element, errorClass, validClass)
{
$(element).parents('.control-group').addClass('error');
},
unhighlight: function(element, errorClass, validClass)
{
$(element).parents('.control-group').removeClass('error');
$(element).parents('.control-group').addClass('success');
}
});
});
HTML:
<form class="form-horizontal" id="register" method='post' action=''>
<fieldset>
<legend>Reg</legend>
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls">
<input type="text" class="input-medium" id="email" name="email">
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password</label>
<div class="controls">
<input type="password" class="input-medium" id="password" name="password">
</div>
</div>
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<button type="submit" class="btn btn-primary">Go</button>
</div>
</div>
</fieldset>
</form>
任何想法有什麼不對?
包括JS文件:jQuery的1.8.3.min.js,bootstrap.min.js,jQuery的validate.min.js
好東西你想通了,因爲沒有辦法讓我們任何人看到這一點。 – Sparky