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.