验证后按对齐
。<form class="form-inline form-padding">
<div class="form-group">
<div class="input-group">
<input class="form-control" placeholder="First Name" name="firstname" type="text" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<input class="form-control" placeholder="Last Name" name="lastname" type="text" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<button type="submit" id="form-button" class="btn btn-primary">Load</button>
</div>
</div>
</form>
验证码:
$('form').validate({
rules: {
firstname: {
minlength: 3,
maxlength: 15,
required: true
},
lastname: {
minlength: 3,
maxlength: 15,
required: true
}
},
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
errorElement: 'span',
errorClass: 'help-block',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});
表单效果很好,但是当我点击“加载”按钮时,按钮的对齐方式不正确。我无法创造一个小提琴,我已经附上相同的屏幕截图。
在提交表格之前
表格提交后
验证后按对齐
。答案 0 :(得分:14)