[twitter-bootstrap] Bootstrap with jQuery Validation Plugin

Try using this sample code. Using the Jquery validation plugin and additional methods. This is the working code for my project. Hope this helps you

_x000D_
_x000D_
//jquery validation booking page_x000D_
 _x000D_
 // Wait for the DOM to be ready_x000D_
$(function() {_x000D_
  // Initialize form validation on the registration form._x000D_
  // It has the name attribute "registration"_x000D_
  $("form[name='book']").validate({_x000D_
   //on key up validation_x000D_
   onkeyup: function(element) {_x000D_
      $(element).valid(); _x000D_
    },  _x000D_
    // Specify validation rules_x000D_
    rules: {_x000D_
      // The key name on the left side is the name attribute_x000D_
      // of an input field. Validation rules are defined_x000D_
      // on the right side_x000D_
      fname: {_x000D_
        required: true,_x000D_
        lettersonly: true_x000D_
        },_x000D_
      lname:{_x000D_
        required: true,_x000D_
        lettersonly: true_x000D_
        },_x000D_
      email: {_x000D_
        required: true,_x000D_
        // Specify that email should be validated_x000D_
        // by the built-in "email" rule_x000D_
        email: true_x000D_
      },_x000D_
      password: {_x000D_
        required: true,_x000D_
        minlength: 5_x000D_
      }_x000D_
    },_x000D_
    // Specify validation error messages_x000D_
    messages: {_x000D_
      fname: {_x000D_
      required:"Please enter your firstname",_x000D_
      lettersonly:"Letters allowed only"_x000D_
      },_x000D_
      lname: {_x000D_
      required:"Please enter your lastname",_x000D_
      lettersonly:"Letters allowed only"_x000D_
      },_x000D_
      email: "Please enter a valid email address"_x000D_
    },_x000D_
    // Make sure the form is submitted to the destination defined_x000D_
    // in the "action" attribute of the form when valid_x000D_
    submitHandler: function(form) {_x000D_
      form.submit();_x000D_
    }_x000D_
  });_x000D_
});
_x000D_
.error {_x000D_
  color: red;_x000D_
  margin-left: 5px;_x000D_
  font-size:15px;_x000D_
}
_x000D_
<script src="design/bootstrap-3.3.7-dist/js/jquery.validate.js"></script>_x000D_
<script src="design/bootstrap-3.3.7-dist/js/additional-methods.js"></script>_x000D_
_x000D_
<form name="book" id="book" action="" method="post">_x000D_
_x000D_
    <div class="row form-group">_x000D_
        <div class="col-md-6 ">_x000D_
            <label class="" for="fname">First Name</label>_x000D_
            <input type="text" name="fname" id="fname" class="form-control" placeholder="First Name">_x000D_
        </div>_x000D_
        <div class="col-md-6">_x000D_
            <label class="" for="lname">Last Name</label>_x000D_
            <input type="text" name="lname" id="lname" class="form-control" placeholder="Last Name">_x000D_
        </div>_x000D_
    </div>_x000D_
_x000D_
    <div class="row form-group">_x000D_
        <div class="col-md-6 ">_x000D_
            <label class="" for="date">Date</label>_x000D_
            <input type="text" id="date" class="form-control datepicker px-2" placeholder="Date of visit">_x000D_
        </div>_x000D_
        <div class="col-md-6">_x000D_
            <label class="" for="email">Email</label>_x000D_
            <input type="email" name="email" id="email" class="form-control" placeholder="Email">_x000D_
        </div>_x000D_
    </div>_x000D_
_x000D_
    <div class="row form-group">_x000D_
        <div class="col-md-12">_x000D_
            <label class="" for="treatment">Service You Want</label>_x000D_
            <select name="treatment" id="treatment" class="form-control">_x000D_
                <option value="">Hair Cut</option>_x000D_
                <option value="">Hair Coloring</option>_x000D_
                <option value="">Perms and Curls</option>_x000D_
                <option value="">Hair Conditioning</option>_x000D_
                <option value="">Manicure</option>_x000D_
                <option value="">Pedicure</option>_x000D_
                <option value="">Nails Extension</option>_x000D_
                <option value="">Nail Design</option>_x000D_
                <option value="">Waxing Eyebrows</option>_x000D_
                <option value="">Waxing Hands/Legs</option>_x000D_
                <option value="">Full Face Waxing</option>_x000D_
                <option value="">Full Body/Body Parts Wax</option>_x000D_
            </select>_x000D_
        </div>_x000D_
    </div>_x000D_
_x000D_
    <div class="row form-group">_x000D_
        <div class="col-md-12">_x000D_
            <label class="" for="note">Notes</label>_x000D_
            <textarea name="note" id="note" cols="30" rows="5" class="form-control" placeholder="Write your notes or questions here..."></textarea>_x000D_
        </div>_x000D_
    </div>_x000D_
_x000D_
    <div class="row form-group">_x000D_
        <div class="col-md-12">_x000D_
            <center><input type="submit" value="Book Now" class="btn btn-primary btn-lg"></center>_x000D_
        </div>_x000D_
    </div>_x000D_
_x000D_
</form>
_x000D_
_x000D_
_x000D_

Examples related to twitter-bootstrap

Bootstrap 4: responsive sidebar menu to top navbar CSS class for pointer cursor How to install popper.js with Bootstrap 4? Change arrow colors in Bootstraps carousel Search input with an icon Bootstrap 4 bootstrap 4 responsive utilities visible / hidden xs sm lg not working bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js Bootstrap 4 - Inline List? Bootstrap 4, how to make a col have a height of 100%? Bootstrap 4: Multilevel Dropdown Inside Navigation

Examples related to jquery-validate

Phone Number Validation MVC Jquery Validate custom error message location Jquery validation plugin - TypeError: $(...).validate is not a function JQuery Validate input file type jquery to validate phone number Bootstrap with jQuery Validation Plugin jQuery Validation plugin: validate check box jQuery select box validation Confirm Password with jQuery Validate MVC 4 client side validation not working

Examples related to twitter-bootstrap-3

bootstrap 4 responsive utilities visible / hidden xs sm lg not working How to change the bootstrap primary color? What is the '.well' equivalent class in Bootstrap 4 How to use Bootstrap in an Angular project? Bootstrap get div to align in the center Jquery to open Bootstrap v3 modal of remote url How to increase Bootstrap Modal Width? Bootstrap datetimepicker is not a function How can I increase the size of a bootstrap button? Bootstrap : TypeError: $(...).modal is not a function