Client-side Form Input Validation with jQuery and Bootstrap

Client-side Form Input Validation with jQuery and Bootstrap
File Size: 21.2 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

A simple lightweight JavaScript library that validates the form inputs and displays the error messages in the Bootstrap modal dialog.

How to use it:

1. Include the required Bootstrap framework on your web page.

<link rel="stylesheet" href="//">  <script src="//"></script>

2. The Bootstrap modal component requires jQuery library to be loaded before the Bootstrap.js.

<script src="//"></script>

3. Include the validation.js

<script src="validation.js"></script>

4. Add Html5 data-* attributes to your form controls as follows.

  • data-title: set the error messages.
  • data-regex: set the password strength using REGEX.
  • data-match: check passwords match.
<input type="text" 
       data-title="Please enter your name"

<input type="password" 
       data-title="Password required" 
	   data-regex-title="Please a enter a password 6 - 20 characters in length"

<input type="password" 
       data-title="Confirmation password required" 
	   data-match-title="Your password and confirmation password do not match"

Change log:


  • Fixed issue where a select element would return a null value and trim would fail

This awesome jQuery plugin is developed by GiancarloGomez. For more Advanced Usages, please check the demo page or visit the official website.