我使用jquery-validate在页面上与twitter bootstrap一起进行一些简单的表单验证。
在Chrome上它完美无缺,但在FireFox上有一个可怕的延迟,文本出现的时间比按键晚得多。除此之外,它运作良好。
这是我的代码,我做错了吗?
<form class="form-horizontal" id="enrolform" method="post">
<fieldset>
<legend>Enrolment Form <small>* required fields</small></legend>
<div class="control-group" >
<label class="control-label" for="invite">Invite Code *</label>
<div class="controls">
<input type="text" class="input-xlarge" name="invite" id="invite">
</div>
</div>
<div class="control-group">
<label class="control-label" for="first">First Name *</label>
<div class="controls">
<input type="text" class="input-xlarge" name="first" id="first" value="{{ first }}" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="last">Last Name *</label>
<div class="controls">
<input type="text" class="input-xlarge" name="last" id="last" value="{{ last }}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">Email Address *</label>
<div class="controls">
<input type="text" class="input-xlarge" name="email" id="email" value="{{ email }}" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="phone">Phone Number</label>
<div class="controls">
<input type="text" class="input-xlarge" name="phone" id="phone" class="required" value="{{ phone }}" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">Mobile Number</label>
<div class="controls">
<input type="text" class="input-xlarge" name="mobile" id="mobile" value="{{ mobile }}" >
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary btn-large"\">Enrol</button>
</div>
</fieldset>
</form>
<script>
$(document).ready(function(){
var validator = $('#enrolform').validate(
{
rules: {
invite: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
first: {
required: true
},
last: {
required: true
},
phone: {
digits: true
},
mobile: {
digits: true
}
},
highlight: function(label) {
$(label).closest('.control-group').addClass('error');
},
success: function(label) {
label
.text('OK!').addClass('valid')
.closest('.control-group').addClass('success');
}
});
</script>
答案 0 :(得分:0)
我怀疑它是因为FireBug html调试器插件。
我尝试从没有安装firebug插件的其他计算机登录,验证就像魅力一样。