Issue with Button Alignment Post Validation.
<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>
Validation Code:
$('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);
}
}
});
The form is functioning well, but there is an alignment issue with the button after clicking Load. Unfortunately, I am unable to provide a fiddle at the moment, so I have shared a screenshot of the problem.
Before Form Submission
After Form Submission
Problem with Button Alignment Post Validation.