how to create the div on the fly in javascript / jquery in this way
<p>i have asp.net mvc 2 application where i have a scenario as follows:
I want to create the parent div and in side it want to create n-number of divs with controls.like</p>

<pre><code>    for(j=0;j&lt;parentCount;j++)
    {
    //Create the parent div
      for(i=0;i&lt;childDivCount;i++)
    {
    //create child div, with controls (like radio,checkboxes).and attach to parentDiv
    }
//Attach parent div to document.
    }
</code></pre>

<p>how to achieve this . </p>

<p><strong>Edited:</strong>
i am bit get satisfaction with answers. but when i am using getJson in each loop as:</p>

<pre><code>  //$.getJSON(url1,,function(data1){
    //for each item in data1 :-
         for(j=0;j&lt;parentCount;j++)
              {
                  //Create the parent div 
                  //$.getJSON(url2,,function(data2){
//**** here j automatically get j++ , why ? ****//
                  //For each item in data2 :-
                  for(i=0;i&lt;childDivCount;i++)
                 {
                     //create child div, with controls (like radio,checkboxes).and attach to     parentDiv
                  }

               });
            //Attach parent div to document.
                }
        });
</code></pre>

<p>when entering for getJson of data2 (subloop) var j get automatically incremented. why that should be ? </p>

<p><strong>Edited:-</strong>
in fact i want to create the question-answer scenario. since in first getJson call i am getting all questions and then in sub getJson call i am getting answers of each question. for each question i am creating div as parent div , and for its answers appending parent div with answers child div. thats all. i didn't wanted to use user control here , so i used the json-jquery combination  to generate scenario. this is what i want to achieve.</p>
