jquery Form Validation Validate

Source: Internet
Author: User
Tags jquery form validation

In the form verification, if the form information is more, resulting in the Submit button and error message is not displayed on the screen, it will be unable to submit, and no friendly prompt question.

The ideal solution is to automatically locate the error prompt when the error is verified, so that the user can view and modify it.

$ ("#Send"). Click (function (e) {        //This line is opera's patch, less it opera is directly with the jump and the picture flashes        $body = (window.opera)? (Document.compatmode = = "Css1compat"? $ (' HTML '): $ (' body ')): $ (' html,body ');        Form submission error locating to a specific error location facilitates user modification            if (!$ (' form). Valid ()) {                var targetid = "";                $ ($ (' form). Validate (). errorlist). Each (function (index, item) {                    if (Targetid = = "") {                        Targetid = $ (item). attr ( ' element '). attr (' id ');}                });                $body. Animate ({scrolltop: $ (' # ' + targetid). Offset (). top-30}, +);                return;            }    );

Jump to the first location of the error

jquery Form Validation Validate

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.