jqBootstrapValidation is a JQuery validation plugin for bootstrap forms.
1. INCLUDE JS FILES
<script src= "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script> <!-- or use local jquery --> <script src= "/js/jqBootstrapValidation.js" ></script> |
2. HTML
<input type= "email" id= "email" required> <input name= "emailAgain" data-validation-matches-match= "email" data-validation-matches-message= "Must match email address entered above" > <input type= "checkbox" name= "terms-and-conditions" required data-validation-required-message= "You must agree to the terms and conditions" > <input type= "checkbox" name= "qualityControl[]" value= "fast" minchecked= "2" data-validation-minchecked-message= "Choose two" maxchecked= "2" data-validation-maxchecked-message= "You can't have it all ways" > |
3. JAVASCRIPT
$( function () { $( "input,select,textarea" ).not( "[type=submit]" ).jqBootstrapValidation(); } ); |
No comments:
Post a Comment