title: How does jquery get a div's height right after loading dynamic content into it?
body: <pre><code>var contentparanum = 1;
  while($(".container").height() &lt; 200){
          paranum++;
          $(".content").append("&lt;p&gt;&lt;/p&gt;");
          $(".content p:nth-child("+contentparanum+")").load("getcontent.php?paranum="+paranum);
          contentparanum++;
          //use load() to add content into container, when the height of container is over 200px the loop stops
  }
  </code></pre>
  
  <p>The problem is the loop never stops. I added alert(".container"); into the loop, I only get 0.It seems the height of the container can be obtained only after while loop is finished. How can I fix this problem?</p>
  
  <hr>
  
  <p>I added the specific code</p>
  
  <p>and the html code here</p>
  
  <pre><code>  &lt;div class="container"&gt;
      &lt;div class="content"&gt;&lt;/div&gt;
    &lt;/div&gt;
  </code></pre>