title: Add class depending on number of child divs
body: <p>I have a parent div in which 2 to 4 child divs will be added dynamically. I need to count the child divs and then add a class to the parent div depending on the # of children.</p>
  
  <pre><code>&lt;div id="parent"&gt;
     &lt;div class="child"&gt;content&lt;/div&gt;
     &lt;div class="child"&gt;content&lt;/div&gt;
     ...
  &lt;/div&gt;
  </code></pre>
  
  <p>Basically, I need to use jquery to say:</p>
  
  <p>If there are 4 child divs, then add class ".four" to parent div.</p>
  
  <p>If there are 3 child divs, then add class ".three" to parent div.</p>
  
  <p>If there are 2 child divs, then add class ".two" to parent div.</p>
  
  <p>I think I need to use .length(), but I can't figure out how to put it all together. I greatly appreciate any advice. </p>
  
  <p>Thank you!</p>