var bbcodes =
[{
contents: {
newBB:["b","u","i","list"],
newBB:["j","k","l","m"],
newBB:["close","stop","back","time"],
},
}];
for(var j=0;j<bbcodes;j++){
var temp= '<span class="button_wrap">';
for (var i=0;i<bbcodes.contents.newBB.length;i++){
temp += '<span class="easy_edit_button easy_button_'
+bbcodes[j].contents.newBB[j]+'">'
+bbcodes[j].contents.newBB[j]+'</span><br />';
}
}
$('body').append(temp+'</span>');
http://jsbin.com/equfow/1/edit
我正在尝试最终创建这个 HTML 标记
<span class="button_wrap">
<span class="easy_edit_button easy_button_b">b</span>
<span class="easy_edit_button easy_button_i">i</span>
<span class="easy_edit_button easy_button_u">u</span>
<span class="easy_edit_button easy_button_list">list</span>
</span>
<span class="button_wrap">
<span class="easy_edit_button easy_button_j">j</span>
<span class="easy_edit_button easy_button_k">k</span>
<span class="easy_edit_button easy_button_l">l</span>
<span class="easy_edit_button easy_button_m">m</span>
</span>
<span class="button_wrap">
<span class="easy_edit_button easy_button_close">close</span>
<span class="easy_edit_button easy_button_stop">stop</span>
<span class="easy_edit_button easy_button_back">back</span>
<span class="easy_edit_button easy_button_time">time</span>
</span>
只是很难让数组和对象循环工作我猜???