A simple Form Validation Utility for Bootstrap 3, Bootstrap 4 for Humans.
bootstrap-validate Version | Bootstrap Version | Documentation |
---|---|---|
v1 | Bootstrap 3 | v1 Download + Docs |
v2 | Bootstrap 4 | v2 Download + Docs |
Read the Documentation at bootstrap-validate.js.org.
$ npm i bootstrap-validate
Include the bootstrap-validate.js script:
<script defer="defer" src="bootstrap-validate.js"></script>
We want the #name
to be not longer than 30 characters!
<div class="form-group">
<label class="control-label">Enter a Name</label>
<input id="name">
</div>
<script>
bootstrapValidate('#name', 'max:30:Your name must not be longer than 30 characters');
</script>
Validating an #email
address couldn't be easier!
<div class="form-group">
<label for="email" class="control-label">Enter your E-Mail</label>
<input class="input" id="email">
</div>
<script>
bootstrapValidate('#email', 'email:Enter a valid email address');
</script>
See the v2 Documentation on https://bootstrap-validate.js.org/v2/ to see all available validation features, examples, and usage with module bundlers.
See examples/ for real-world usage.
You can find current Releases under Releases and older Releases for Bootstrap 3 and Bootstrap 4 in the Download Archive.
See CHANGELOG.
Validation Rules are at least unit-tested. Use npm test
to spin up the test suites.
Licensed under the MIT License, see LICENSE.