"Input Validation "
Bootstrap 3.1.0 Snippet by insiderz

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <form id="new-user-form" class="form-horizontal" role="form" action="" method="post"> <div class="form-group "> <label for="txtusername" class="col-sm-3 control-label" >Username*</label> <div class="col-sm-7"> <input id="txtusername" name="txtusername" tabindex="1" type="text" class="form-control" > <span id="showusername" class="help-block"></span> </div> </div> <div class="form-group"> <label for="txtpassword" class="col-sm-3 control-label" ">Password*</label> <div class="col-sm-7"> <input id="txtpassword" name="txtpassword" tabindex="5" type="password" class="form-control"> </div> </div> </form>
$(document).ready(function(){ $('#new-user-form').validate( { rules:{ txtusername:{required:true,minlength: 6}, txtpassword:{required:true,minlength: 6}, }, messages:{ txtusername:"enter username, minimum 6", txtpassword:{ required:"enter password", minlength:"minimum 6"}, }, highlight: function (element) { $(element).closest('.form-group').addClass('has-error'); }, unhighlight: function (element) { $(element).closest('.form-group').removeClass('has-error'); } }); });

Related: See More


Questions / Comments: