Quickly learn about jQuery in the jquery plug-in. validate. the use of js Form Verification plug-ins is one of the oldest jQuery plug-ins. It has been verified by different projects around the world and has been well received by many Web developers, if you are interested, you can refer to form verification, which is th
also very easy to convert a dom object to a jquery object. Just add $ (), and then you can use the jquery syntax to operate the object. I think this is the most common use. Let's take a look at the example.
$ ('Input [name ^ = "hour"] '). each (function (index) {this. value = index; // this is a dom object, js format}); $ ('
Using jquery's validate plug-in to do client-side validation is handy, and here's an example of using the Validate plug-in to authenticate user registration information.
This example uses the 1.5 version .
The example is done under SSH with the following code:
registe.jsp
Main methods of background Registeaction.java
Public String Execute () throws Exception {Map session = Actioncontext.
people use is this. Take a look at the example.
$ (' input[name^= "Hour"]). each (function (index) {
this.value=index;//this is dom to image, JS writing
});
$ (' input[name^= "Hour"]). each (function (index) {
$ (this). Val (index);//$ (this) is a jquery-like, jquery notation
});
Two,
Validate multiple elements with the same name value:$ (". Send"). Click (function () {var a = 0; var b = 0; var c = 0; var d = 0; Reset the Name Value $ ("input[name^= ' ContactName '"). each (function () {$ (this) . attr (' name ', ' contactname[' + A + ') '); a++; }) $ ("input[na
JQuery. validate form verification, validateform reset Verification
JQuery verification framework:
Basic html code:
1 2 3 40 4142 html:43
From the above code, I will talk about the use of jQuery Validation.
1. validate (options) is the start of running form. It is used
content must be enclosed in quotation marks, as shown in the following code:Class= "{required:true,minlength:5,equalto: ' #password '}"2, officer rules written into the JS code$ (). Ready (function () {$ ("#signupForm"). Validate ({ rules: { FirstName: "Required", email: { Required:true, email:true }, password: { required:true, minlength:5 }, confirm_ Password: { required:
The JQuery.validate.js plugin is used to validate form input and its configuration is very simple. Supports multi-event triggering, comes with multiple validation rules, and also supports custom validation rules.1, configuration method.Import the jquery library first, then import the validate plug-in, if the Chinese hi
Introduction of Jquery.validate
The JQuery.validate.js plug-in is used to validate form input, and its use configuration is simple. Supports multiple event firings, with multiple validation rules, and custom validation rules.
1. Configuration method
First import the jquery library, then import the Validate plug-in,
Reprinted from: Corn string
And http://www.cnblogs.com/best/archive/2011/09/05/2167817.html Kissy: small, flexible, simple, practical, pleasant coding, and happy development. The Kissy principle is true. I just made a registration page and used the Form validation component of kissy.
Example above:
Jquery extension validate:
Jquery.
Jquery Validate related parameters
Defining Chinese messagesvar cnmsg = {Required: "Required field",Remote: "Please fix this field",Email: "Please enter the correct format of e-mail",URL: "Please enter a valid URL",Date: "Please enter a valid date",Dateiso: "Please enter a valid date (ISO).",Number: "Please enter a valid digit",Digits: "Can only enter integers",
: "Please enter the correct email address"}, Userpwd: {required: "Please enter password", minlength: "Character length cannot be less than 8 characters", Ismypassword: "The password must consist of a number, an English letter and a special character (!,[emailprotected]#$%^*?_~)"}, Confuserpwd: {required: "Please enter a confirmation key Code ", minlength:" Character length cannot be less than 8 characters ", Equalto:" Two times password
Jquery. validate is a B/S client verification framework based on jquery. With the advantages of jquery, we can quickly verify some common input, greatly improving the development efficiency, the following are my study notes:
}-?)? d{7,9}$/g;return this.optional (Element) | | (Tel.test (value));}, "Phone number format is wrong!");ZIP Code VerificationJQuery.validator.addMethod ("ZipCode", function (value, Element) {var tel =/^[0-9]{6}$/;return this.optional (Element) | | (Tel.test (value));}, "bad postal code format!");Must be validated at the beginning of a specific stringJQuery.validator.addMethod ("Begin", function (value, element, param) {var begin = New RegExp ("^" + param);return this.optional (Element) | | (Be
Form Verification is the most common in daily projects. Using a good JS library can help us get twice the result with half the effort. Jquery. Validate is undoubtedly a good choice.
Jquery. validate. This verification library is a jquery plug-in written by bassistance.de. ba
Refer to the jquery validation plugin's demo learningPage Introduction jquery.js and Jquery.validate.js can;The language pack is introduced because the prompt information in the validation is in EnglishThe contents are as follows(function (Factory) {if (typeof define = = = "function" define.amd) {define (["jquery", ".. /jquery.validate "], factory);} else if (typeof module = = = = "Object" module.exports)
The basic usage of JQuery validate extension
Validate is used for B/s structure client verification using the jquery extension, the use of the need to refer to two JS files, respectively:
The default prompts at the back of the text box can modify Jquery.validate.min.js, find and replace English in Chinese, and styles
This article introduces the jquery Validate form Verification plug-in, add Class attribute form of verification, share for everyone to reference, the specific content as followsThe effect is as follows:
First, jquery form verification plug-in, add Class attribute form of checksum
Second, the default rulesdefault checksum rule:
(1) Required:true mu
This article describes how to submit the validate and form plug-ins in jquery. For more information, see the following section: This article mainly discusses jquery. combine validate with jquery. form to verify and submit the form.
Method 1: Use the submitHandler option of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.