Simple, smart and pleasant validation solution.
Clone or download
Latest commit 3e93ebe May 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo update demo Nov 18, 2016
dist [build] 1.1.4 May 6, 2018
src edits May 6, 2018
test update Jun 10, 2016
.editorconfig disable insert_final_newline config Aug 22, 2016
.gitignore edits Jul 17, 2016
.travis.yml Cache npm modules on travis builds Jul 18, 2016 edit Aug 28, 2016
bower.json edit Jul 25, 2016
gulpfile.js update gulpfile Feb 7, 2017
package.json [build] 1.1.4 May 6, 2018


Build Status Downloads Version License MIT

Simple, smart and pleasant validation solution.

Download the latest release or install package via npm or bower

$ npm install nice-validator
$ bower install nice-validator

Getting started

1. Include jQuery 1.7+

2. Include nice-validator

width <script> tag:

<script src="path/to/nice-validator/jquery.validator.min.js?local=en"></script>

via webpack


via module loader Requirejs:

    paths: {
        jquery: '',
        validator: 'path/to/nice-validator/local/en'
    shim: {
        validator: ['path/to/nice-validator/jquery.validator.js?css']


3. Config rules

<form id="form1">
<input type="text" name="field1" data-rule="required;email;remote(checkEmail.php)">
<input type="text" name="field2" data-rule="required;length(6~16)">
<input type="text" name="field3" data-rule="match(field2)">
<input type="text" name="field4" data-rule="range(0~100)" id="field4">
<input type="text" name="field5" data-rule="required(#field4:filled)">
<input type="text" name="field6" data-rule="required; mobile|email;" data-msg="Please fill mobile or email">
<input type="text" name="field7"
    data-rule="required; !digits; length(6~)"
    data-msg-digits="Please not fill pure digits"
    data-msg-length="Please fill at least {1} characters.">
<input type="checkbox" name="field8" data-rule="checked">
... yadda yadda ...

It has started to work when you use native submitting.

4. Handle submit (Optional)

$("#form1").on('valid.form', function(){
    // You can do something, then submit form by native
    // this.submit();
    // or submit form by ajax
    $.post("path/to/server", $(this).serialize())
            // do something


Browser Support

  • IE6+
  • Chrome
  • Safari 4+
  • Firefox 9+
  • Opera

Bugs / Contributions

  • Report a bug
  • To contribute or send an idea, github message me or fork the project


Install dependencies:

$ npm install -g gulp
$ npm install

Run test and build:

$ gulp


nice-validator is available under the terms of the MIT License.