Fixing jQuery Validator Plugin In Internet Explorer 6
Ok, so I was writing some validation code to stop empty submition of a form in a quiz/servey I was building for Natural Tys. The [...]
Ok, so I was writing some validation code to stop empty submition of a form in a quiz/servey I was building for Natural Tys. The easiest was to do client side validation is by using the excellent Javascript frameworks that are available. My personal favourite is jQuery which has a excellent validation plugin available, you can get it over at bassistance.de. The only problem was that it didn’t seem to work in Internet Explorer 6, dispite the fact that the demos provided at bassistance.de worked great. I kept getting a ‘method and/or object does not exist’ error, or something similar. You may also receive some syntax errors such as ‘unexpected :’. Anyway if you’re getting this & you’re also ready to bang your head against the wall, here is how to fix it.
The problem is all to do with the fact most HTML files are geneated with charset=UTF-8 in the meta tag. If you make your own HTML files then you may not have this problem, I don’t know because I use Dreamweaver which does all the meta tag stuff for you. Anyway, if your HTML file is UTF-8 then all you need to do is change your script tag. You should have a script tag that looks something like this, inbetween your head tags:
<script src="jquery.validator.pack.js" type="text/javascript"></script>
All you need to do is replace it with this:
<script src="jquery.validator.pack.js" type="text/javascript" charset="ISO-8859-1" ></script>
That should fix it. The problem is simple. FF, IE7 and most other browsers can automatically detect and switch character sets as they need to, but Internet Explorer 6 being as useless as it is can’t. That’s why you need to hold it’s hand and actually tell it what character set the file is encoded in. Why is the file in ISO-8859-1 encoding? I don’t know…








Discussion: 19 Comments
Hi, you save my day, but the correct char code is “ISO-8859-1″
Thanks.
THANK YOU SO MUCH! This was a total life saver!
No problem Bobby.
I don’t usually comment all the blogs I find on the Internet, but man, THANK YOU!! My issue wasn’t exactly related to what you mentioned, as I was receving “Syntax error” from IE6, using JQuery $(document).ready(function() … But really, you saved my life! Thanks you so much for your comment!
No problem.
Thank you so much, I was really about to bang my head against the wall, and now my nightmare is over!
I was actually trying to get it to work with Thickbox, and wondered about that silly Jquery validator undefined mistake.
Problem solved!
No problem.
I’m glad that it helped.
Great…. works! Thanks fot the tip!
No problem.
It looks like it is in that character set because of Jörn Zaefferer. If it doesn’t come out in this post, there is a double dot accent mark above the o in Jorn. This woudn’t be possible to display in utf-8 as a single character.
Well spotted Mario. Yes it did come out in your comment & I’m guessing that your right. It’s a right pain if you don’t know though.
thanks a lot Veneficus. it really saved me from a big big trouble and hours of struggle.
Great! Thank you!
Thank you for sharing, I was going nowhere fast until I found your post. Just added you to my feeds, Cheers.
Not a problem. Thanks for adding me. Hope you find my new posts useful too.
Thaaaaaaank you!
You saved my day!
No problem.
Good, I am impressed your topic and hope that next time, I will get help from you more and more