Home >Web Front-end >JS Tutorial >A simple script validation plug-in based on jquery_jquery
It mainly uses jquery and a custom attribute wl_check. The attribute description is as follows:
1. Syntax
[need:true,type:int,maxlen:15,minlen: 2]
2. Keywords
need: required restrictions for the text input box
regtype: regular expression category verification of the text input box
minlen: text The minimum input length of the input box
maxlen: the maximum input length of the text input box
minval: the maximum value of the numeric text input box
maxval: the maximum value of the numeric text input box
notval: drop-down Required settings for the box
minselect: the minimum number of options for a single check box
maxselect: the maximum number of options for a single check box
...
3. Scope of use
input:text
input:radio Note that the id is '_i'
input:checkbox Note that the id is '_i'
textarea
select
4. Description
1. When the value of the form control with the wl_check attribute changes, the corresponding verification method will be called. This method has no return value, but only prompts and locates the error.
2. When posting the page, you need to verify the form control with the wl_check attribute in a certain domain and return true; otherwise, a prompt message will pop up and the submission will be cancelled.
5. Usage example - see demo
means that the text box is required and has a maximum of 10 characters and a minimum of 2 characters
Demo code:http://demo.jb51.net/js/wl_check/index.htm