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
I'm trying to create this HTML markup in the end
<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>
just having a difficult time getting the array and object for loop to work I guess???
new
like that since it's a reserved word. Wrap it in quotes. Secondly, you cannot re-use object keys over and over either. Just two things I noticed immediately. – Jonathan Sampson Jun 13 '13 at 0:36new
as a property index will result in an unexpected:
message. It's a reserved word. – Jonathan Sampson Jun 13 '13 at 0:49