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>");
});
精彩评论