IE8 Expected Identifier Error

Hello,

This bug gets thrown sometimes in IE8 and under and it can be caused by many things. I just got caught out debugging an error whereby a variable stored in some json was called ‘class’. The dev who made it was storing the css class name for an object that would get appended dynamically into markup. The json looked like this:-

“class”: “customer”

The issue is that “class” is a reserved keyword in IE. GIven this, the quickest and simplest fix for me was to just change the variable name to “className”.

 

Advertisements

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: