Be the first to know about special offers and new products for web developers and Internet business owners.
I will never share your email address with the bad boys. Period.
|
Be the first to know about special offers and new products for web developers and Internet business owners. I will never share your email address with the bad boys. Period.
The latest
Recent comments
|
Javascript Expected Identifier Error On Internet Explorer
Submitted by alexis on Wed, 2007-11-21 16:39.
A really weird thing was happening with some jQuery code, I was getting this error in both Internet Explorer 6 and 7: Expected Identifier. I googled a little and found this could happen if you included an extra comma in some expressions but that wasn't my case. Some coffees later I found the offending code was:
Yep, class seems to be a reserved word in Internet Explorer, thanks again Microsoft for making web developers lives so difficult. I just changed the variable name to fix the error, something like this:
A little later I found another mention of the class problem, hell!, where was this article when I was looking for the fix? It seems you can't set classes with jQuery's attr() method in Internet Explorer either, well, I guess that's why we have addClass() and removeClass(). Trackback URL for this post:http://ventanazul.com/webzine/trackback/82
|
Want to launch a online store, need a new look for your website, market your services on the Net or build a virtual community? Not a problem, let's talk about it. Where To Host Your Sites? |
Just stopping buy to say I
Just stopping buy to say I hate that peace of crap, too. Guess what? IE is giving me the same headaches right now...
Thanks for the post--saved
Thanks for the post--saved me a few hours of agony. At first I thought it was a document.all or variable scope problem, but turns out you just can't use the word class as a variable.
Thanks
Ha it's always the obvious.
in my case:
js.Return....Yeah I know dumbass.
Cheers buddy.
Thanks
This post just saved me untold hours of trying to debug IE's cryptic and near useless error reporting. Changed var class to var myClass and now all is well.
Post new comment