Internet Explorer 8 error - Expected Identifier, string or number - JQuery
Wondering what to do about this. Googling but can't seem to find anything. I am using the Cycle Plugin for JQuery and works great in all browsers but IE of course. Same problem in IE 6, 7, and 8.
Expected identifier, string or number referring to line 13 of my js file. Anyone know what to do here?
js file:
$(document).ready(function() {
$('.slideshow').cycle({
speed: 200,
timeout: 15000,
pager: '#tabs',
pagerEvent: 'mouseover',
pauseOnPagerHover: true,
pagerAnchorBuilder: function(i, slide){// c开发者_JS百科allback fn for building anchor links: function(index, DOMelement)
return '<a href="path-to-link"><img src="../images/tabback.png' + slide.src + '" height="47" width="189" /></a>';
},
}); <------THIS IS LINE 13
});
Remove the ,
after your pagerAnchorBuilder
callback.
Oh Oh, I know this one. There is an extra ,
at the end of line 12 which IE doesn't like. I have had this bite me multiple times.
It is always a good idea to put your javascript through jslint.
I know it's been posted 2 years ago and is already answered. But I had a different reason for the same error message on the same browser, so I thought I'd share how I fixed my issue.
I just had the same error in IE8 and older (newer IE and all other clients were fine). The reason I was getting it was not the last comma in static var or function definition. I named one of my variables "class". IE8 and older don't like that, their interpreters throw the same "Expected Identifier, string or number" error when they try to parse that name. So, if you have anything named "class" in your script and get that error, just rename that thing to something else.
精彩评论