SimpleValidate is a simple verification plug-in. Based on JQuery, it can be compatible with various browsers after small bugs are modified. The self-used version is provided for download. If you do not need to perform real-time verification of onfocus and onblur, if you do not want to define verification rules for each table through JS, if you only need to perform verification and feedback at the time of submission, if you prefer a simple code structure, I think simpleValidate is a good choice.
According to the attention and downloads, this plug-in is not very popular, but it doesn't matter. It is my dish.
At the bottom, the open-source DEMO is very detailed and easy to use.
The original version does not support IE because the comma and length of JSON are reserved words. The solution is to delete unnecessary commas before "}", and change the variable length to another variable name, I changed one and made the prompt content in Chinese. It is currently in use and no other bugs have been found: jquery. simple. validation. js
Define the data-rules attribute:
Identify multiple verification rules by using the "#", use the plus sign "+" with the verification comparison value, and use the horizontal bar "-" with feedback on the project title. Below are some basic statements:
The Code is as follows:
Define all forms for verification before submission:
The Code is as follows:
$ ('Form'). bind ('submit ', function (){
Var message = $ (this). validate ();
If (message! = True ){
Alert (message );
Return false;
}
Return true;
});
Open Source Address: https://github.com/capucinno-lee/jquery-simple-validation
DEMO address: http://demo.jb51.net/js/2014/jquery_simple_validation/