Tuesday 7 October 2008

Here's a cute little bug...

This one drove me mad today. I'm working on a slide/reveal panel mechanism for an project under development at work, using jQuery, and almost straight away, everything worked perfectly in Firefox (once I'd sussed the HTML mark-up needed anyway!).

However, nothing seemed to happening at all when I tested in IE7, and the only clue IE would give me was a somewhat cryptic "Expected identifier, string or number".

Huh? What's that supposed to mean?

Well, a bit of Googling and I found the solution. According to Cow at NeoDragon it's an IE issue (surprise surprise)...

"In Javascript you have lists like:


var list = { opacity: 0.5, height: 0.5} 

Similar syntax is used to group functions:


var MyFuncs = {foo: function() {},bar:function() {},} 

The above code should work fine in real web browsers such as Firefox. IE will give a screwed up error such as "Expected identifier, string or number". Just remove the comma after the last function and the error be gone."

Nice one Cow!! (I couldnt find the authors real name, but please let me know if you do!)



Powered by ScribeFire.

No comments:

Post a Comment