Instead of immediately appending your newly created div to the body, you can append more stuff to it first:
Code://create div, assign to variable: var myDiv = $("<div />", { "class": "dynamicDiv", id: "div" + j, innerHTML: "div no:" + j}); //append whatever you want to the div... myDiv.append("<table><tr><td>first row of the table</td></tr></table>"); //append stuff to the table if you want... $("table",myDiv).append("<tr><td>a second row in the table</td></tr>"); //when you're done making changes, append the div to the body like you were doing before: myDiv.appendTo("body");




Reply With Quote
