title: Writing a for loop to create divs
body: <p>What I am trying to do is write a for loop to create a certain number of divs. The number of divs depends on the information i have in a database. For example there are 15 checkboxes, i need a for loop to create a div for each checkbox the user clicked. I'm not worried about the mysql side of things right now, i'm just focusing on the for loop. </p>
  
  <p>So i have a main div that is 800px wide. Let's say the user clicks 8 checkboxes, i want to figure out how to write a for loop that will create 2 rows of 4 divs, each 200px wide. so 4 divs on each row. It doesn't really matter what is in the div right now i just need to know how to tackle something like this. </p>
  
  <p>Any ideas that will lead me in the right direction?</p>
  
  <p>Here is some code:</p>
  
  <pre><code>$(document).ready(function(){
      for(i = 0; i &lt; (the number of checkboxes clicked); i++) {
          $('body').append('&lt;div id="div'+ i +'" /&gt;');
      }
  });
  </code></pre>
  
  <p>Then div will have the same css code like width 200px blah blah blah...</p>
  
  <p>I guess i need to get the checkboxes clicked from the database and make a div for each checkbox.</p>