JavaScript/ jQuery Error ‘expected identifier, string or number’ in IE

IE sucks… and nothing to do coz. it’s windows default browser.

Hi this is my first post on JavaScript in my blog.. 🙂 I get a new error (JavaScript Error ‘expected identifier, string or number’ in IE) in JavaScript on IE when developing an application and got a solution on googling and post this here….

Sometimes we get this error and can’t seem to find a solution. It is worked on Firefox without no problem but on IE it throw an “expected identifier, string or number” error to the last line of the variable declaration. Take a look at the following codes that I was worked on..

1.  $(“#scrollin_project”).carousel({
2. direction: “vertical”,
3. loop: true,
4. dispItems: 3,
5. autoSlide: true,
6. animSpeed: 1500,
7. nextBtn: ‘<input id=”btn_down” type=”button” value=”” />’,
8. prevBtn: ‘<input id=”btn_up” type=”button” value=”” />’,
9. });

In IE, the error was reporting “expected identifier, string or number” on the last line of my (above) codes. Look at the line number 8, there is a comma (,) at the end of the code. And IE catch this as an JavaScript Error.

And Here is the error free codes

1.  $(“#scrollin_project”).carousel({
2. direction: “vertical”,
3. loop: true,
4. dispItems: 3,
5. autoSlide: true,
6. animSpeed: 1500,
7. nextBtn: ‘<input id=”btn_down” type=”button” value=”” />’,
8. prevBtn: ‘<input id=”btn_up” type=”button” value=”” />’
9. });

Now look at the end of the line number 8 of the above codes, it simple, I just delete the comma(,) and now there is no error on any browser.

Advertisements

3 thoughts on “JavaScript/ jQuery Error ‘expected identifier, string or number’ in IE

  1. Having read this I thought it was really informative. I appreciate you finding the time and effort to put this informative article together. I once again find myself personally spending way too much time both reading and leaving comments. But so what, it was still worth it!

  2. I just want to mention I’m all new to blogging and definitely liked this web page. Most likely I’m planning to bookmark your blog . You really have wonderful well written articles. Thanks a bunch for sharing with us your blog site.

Inspire Me :)

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s