Method for submission of validate and form plug-ins in jquery _ javascript skills

Source: Internet
Author: User
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 jquery. validate to execute the callback function when the form passes verification. In this callback function, the form is submitted through jquery. form;

Method 2: Use beforeSubmit of jquery. form, that is, the callback function executed before the form is submitted. If this function returns true, the form is submitted. If false is returned, the form is terminated. Based on the valid () method of the jquery. validate plug-in, you can use jquery. form to verify the form when submitting a form.

Method 3: Use jquery. validate to verify the form's validate method. The advantage of this method is that it controls form verification more freely.

Example: The following three examples are used to describe the above three methods.

Load a CSS style File

The Code is as follows:

CSS style File Content

input{ height:25px; line-height:25px; padding-left:4px;}span.checked{ padding: 0px 5px 0px 25px; margin-left: 10px; margin-top: 0px; margin-bottom: 3px; height: 25px; line-height:25px; font-size: 12px; white-space: nowrap; text-align: left; color: #E6594E; background: url("images/acion2.png") no-repeat 3px; /* #FCEAE8 */}span.unchecked{ padding: 0px 5px 0px 25px; margin-left: 10px; margin-top: 0px; margin-bottom: 3px; height: 23px; line-height:23px; font-size: 12px; border: 1px solid #E6594E; white-space: nowrap; text-align: left; color: #E6594E; background: #FCEAE8 url("images/acion.png") no-repeat 3px;}

Load javascript files

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.