Real-time validation before submitting your forms for Bootstrap. Compatible with Bootstrap 3.0 and up.
- Extract the downloaded zip file (mjFormValidation.zip)
- Insert below codes to the section of your page
<link rel="stylesheet" type="text/css" href="mjFormValidation.css" />
- Insert below codes before the tag of your page
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="mjFormValidation.js"></script>
<script type="text/javascript">
$(function(){
$('form').mjFormValidation({
error_messages : {
required : 'This field is required',
email : 'Invalid e-mail address',
numeric : [
'This field must be numeric',
'This field must be at least {minimum}',
'This field must not exceed to {maximum}',
'This field must be at least {minimum} and must not exceed to {maximum}'
],
url : 'Invalid URL',
match_field : 'This field should match {match} field value'
}
});
});
</script>
- Add the following classes according to your preferences:
- required – to validate required fields
- email – to validate e-mail address fields
- numeric – to validate numeric fieldsAdditional options (element attributes):
- data-minimum – minimum value for numeric field
- data-maximum – maximum value for numeric field
- url – to validate url fields
- match – to validate if two fields are matchedAdditional options (element attributes)
- data-match-field – name attribute of the element you want the field to match
- data-match-field-label – label of the field you want to match
CHANGED: .size() to .length to adopt latest jQuery function FIXED: match validation error
FIXED: validation for checkboxes and radio buttons bug
ADDED: validation for checkboxes and radio buttons
ADDED: validation for URLs ADDED: validation for matching two fields value ADDED: error messages customization RENAMED: “digits” class to “numeric” class FIXED: validation for mixed classes
Initial release