Hi, I don't understand how this works. If I'm writing JS code in the head of the document, and I want to wrap a chunk of it within a CSS div, how do I do this?
For instance:
Code:
for (a=0;a<req_Links;a++){
e$("menu_Space").innerHTML = e$("menu_Space").innerHTML + "<div class='parent" + a + "'>" + e$("link_Name" + a).value + "</div>";
for(z=0;z<nTSplit[a].length;z++){
e$("menu_Space").innerHTML = e$("menu_Space").innerHTML + "<div class='nest" + a + "'>" + nTSplit[a][z] + "</div>";
}
}
I want to wrap each run of the loop (technical term?) in a separate div. So the first time it runs I want to name the output #example_id0, then #example_id1 etc, and so on.
So if my chunk of code runs 3 times, I want 3 separate divs for each output.
e$ = document.getElementById btw.
I thought I could just write in the start of the loop in document.getElementById("menu_Space").innerHTML, and close it AFTER the code in the same way, but this doesn't work. I'm just a bit confused.
Any help is greatly appreciated.