Yesterday my friend come across a javascript error “expected identifier, string or number” in internet explorer (IE). The same code was running great in Mozilla and chrome. here the snap of code causing an error:
var horizontalTab = { "MyProducts" : [ { "ImageName" : "my_products.png", "SelectedImageName" : "my_products_selected.png", "HoverImageName" : "myProductsHowerbottom.png" } ], "MyTeam" : [ { "ImageName" : "my-team-white_bottom.png", "SelectedImageName" : "my-team-bottom.png", "HoverImageName" : "myTeamBottomHover.png" } ], "MyFinance" : [ { "ImageName" : "finance_white-legal-Bottom.png", "SelectedImageName" : "finance-legal-bottom.png", "HoverImageName" : "FinancenLegalHoverBottom.png" } ], }
The javascript debugger displayed the error on function which does not have to do anything with actual cause. Luckily we observed the line 22, extra comma present at last declaration in JSON was causing this error.
I hope this article will help lots of people if they came across same problem and save hours.
Leave a Reply to TomCancel reply