Home > Web Front-end > JS Tutorial > body text

simpleValidate simple validation plug-in based on jquery_jquery

WBOY
Release: 2016-05-16 17:01:45
Original
1219 people have browsed it

If you don’t need to do instant verification of onfocus and onblur, if you don’t want to define validation rules through JS for each form, if you only need one verification and feedback when submitting, if you like a simple code structure , I think simpleValidate is a good choice.

Judging from the attention and downloads, this plug-in is not very popular, but it doesn’t matter, it is my favorite.
The download address is at the bottom, it is open source, the DEMO is very detailed, and it is quite easy to get started.
The original version does not support IE because the commas and length of JSON are reserved words. The fix is ​​to delete all unnecessary commas before "}" and use other variable names for the variable length. I changed one, The prompt content has been Chineseized and is currently in use. No other bugs have been found yet. Download address: jquery.simple.validation.js

Define the data-rules attribute:
Use the pound sign "#" to distinguish multiple verification rules, use the plus sign " " to attach the verification comparison value, and use the horizontal bar "-" to attach the feedback project title. The following is the basic writing method

Copy code The code is as follows:




Define all forms to be verified before submission:

Copy code The code is as follows:

$('form').bind('submit' ,function(){
var message=$(this).validate();
if(message!==true){
alert(message);
return false;
}
return true;
});

Project open source address: https://github.com/capucinno-lee/jquery-simple-validation
DEMO address: http://demo.jb51.net/js /2014/jquery_simple_validation/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template