开发者

"Uncaught SyntaxError: Unexpected token [" all of a sudden in Chrome

It was working fine up 开发者_StackOverflowuntil very recently. Chrome tells me this is incorrect with "Uncaught SyntaxError: Unexpected token ["

$.each($regions, function(index, [value1, value2]) { 
    $("#regions .options").children("#r").append("<div class='brick' id='" + index + "' name='" + value2 + "'>" + value1 + "</div>");
});

Firefox and firebug do not raise a stink and everything is working alright. I don't understand what happened in Chrome. I swear this exact code worked before.

Chrome v.12.0.742.122


You cannot declare a function with parameters like that([value1, value2]). Try this

$.each($regions, function(index, values) { 
    $("#regions .options").children("#r").append("<div class='brick' id='" + index + "' name='" + values[1] + "'>" + values[0] + "</div>");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜