Correctly apply the jquery. Validate. js tag in ie9, IE8, and IE7.

Source: Internet
Author: User

In web development, IE browser always brings us headaches, because many JS results have received perfect support in Firefox and chrome, except IE6, 7,8, 9 present all kinds of imperfect support. Here I will summarize jquery. validate. how can JS labels be perfectly compatible with IE6, 7,8, and 9.
(1) First and foremost, the latest official tag Library (jquery. validate. JS), because it is not the latest tag library that has the source code change question, this is a headache.
(2) Pay attention to writing. Let's look at the example below.
$ ("# Login"). Validate ({
Rules :{
Username: {required: true },
Password: {required: true}
},
Messages :{
Username: {required: "Enter the Logon account! "},
Password: {required: "enter the password! "}
},
Errorplacement: function (error, element ){
Error. appendto (element. Next (). Find ("span "));
}
});
As long as I keep writing, IE6, 7, 8, and 9 can run normally. Here, the master attaches great importance to it. IE is very jealous of even a small comma. See the following Code .
$ ("# Login"). Validate ({
Rules :{
Username: {required: true },
Password: {required: true },
},
Messages :{
Username: {required: "Enter the Logon account! "},
Password: {required: "enter the password! "},
},
Errorplacement: function (error, element ){
Error. appendto (element. Next (). Find ("span "));
},
});
There are only three more "," and there is no question in Firefox and chrome. However, in IE, more than one comma is not allowed. The Master will pay attention to it in the future. IE is also extremely sensitive in the time of page layout. When writing the front-end code, the master must do his best not to present exceptions. So that it can run normally in IE.

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.