Bootstrap works well with HTML5's default form validation. Adding an attribute called required to any form element will prevent the form from being submitted. Bootstrap's JavaScript doesn't have any predefined validation functionality. It provides you with CSS classes that can be applied to the form elements on runtime. These classes are important to highlight which form element needs attention by the user.
Let's have a look at some of the form validation classes by Bootstrap:
These classes are applied to the .form-group
element. For example, adding the .has-error
class to any .form-group
element will highlight both label and form elements with a red color:
<div class="form-group has-error"> <label for="emailField">Email address</label> <input type=...