我试图遍历对象,以便输出键和值,但我不断收到意外的字符串错误。有人可以帮忙吗?
var obj = {
'a.video-0': "<span>Benefits of USF\'s Online Master\'s Degree Program in Management Information Systems</span>"
'a.video-1': "<span>How are the courses optimally designed</span>"
};
for( key in obj ) {
jQuery( [key] ).html(obj[key]);
});
答案 0 :(得分:0)
您错过了&#34;,&#34;,并且您有)导致其他错误。
试一试:
var obj = {
'a.video-0': "<span>Benefits of USF\'s Online Master\'s Degree Program in Management Information Systems</span>",
'a.video-1': "<span>How are the courses optimally designed</span>"
};
for( key in obj ) {
jQuery(key).html(obj[key]);
};
问候。