【发布时间】:2015-04-26 03:26:30
【问题描述】:
我完全不知道问题出在哪里,但下面的 for 循环会抛出“Unexpected token for”。
删除 for 循环会导致关闭 };被称为意外令牌。
$.fn.appExt = function() {
$(data).find('a').each(function() {
fileExt = this.href.replace(window.location, '').replace('localhost/Program/Code', '').split('.')[1];
if ($.inArray(fileExt, ext) == -1 && typeof fileExt !== 'undefined') {
ext.push(fileExt);
}
}
// here lies the problem apparently
for (i = 0; i < ext.length; i++) {
$('#ext').append('<h5>' + ext[i] + '</h5>');
}
};
【问题讨论】:
标签: jquery loops for-loop token