title: jquery : element height returns 0
body: <p>Hi have a dynamic content HTML that has the following structure</p>
  
  <pre><code>&lt;Div id=1&gt;
  .....
  &lt;/div&gt;
  and then 
  &lt;Div id=N&gt;
  .....
  &lt;/div&gt;
  </code></pre>
  
  <p>I am trying to print preview this in IE6 (yes IE6!)
  Since IE6 DOES not support page-break-inside: avoid, I am using jquery</p>
  
  <p>In the ready() function, I am checking for each div's height and then adding to the list of other divs' heights. If the sum is more than 700 (for instance), I insert a HR tag with page-break-after attribute.</p>
  
  <p>So in this manner I can show the page breaks in IE6</p>
  
  <p>However, the jquery for fetching the element height returns 0 under normal scenarios. That is, if there NO IE error thrown the element height is 0</p>
  
  <p>If there is an IE error for instance Null reference or undefined, the jquery element height returns correct height.</p>
  
  <p>Please help to resolve this</p>
  
  <p>Jquery code used to add HR tag to show the page split</p>
  
  <pre><code>//Function to show the page break
  function PageBreak()
  {
      var i1=0;
      var prevId='';
      var heights='';
      var CurrentDiv=0;
      var CurrentDivHeight=0;
  
      //For each DIV which contains the medication, show the page break at appropriate rows
      $(".divtblPrint").each(function(i) 
      {
          //Check the current Height
          //if currentHeight + sum of previous heights is &gt; HeightToCheck then 
  
          CurrentDivHeight=$(this).outerHeight(true);
  
          if((i1+CurrentDivHeight)&gt;HeightToCheck)
          {
              var HTML='';
              HTML+="&lt;hr class='pagebreak' style='visibility:hidden;'/&gt;";
              $(this).before($('&lt;div class="new"&gt;'+HTML+'&lt;/div&gt;'));
              //reset the counters since this is fresh page
              i1=CurrentDivHeight;
              prevId='';
              //return;
          }
          else //height not yet crossed, so keep loops
          {
              prevId=$(this).attr('id');
              i1+=CurrentDivHeight;
          }
  
      });
  
  }
  </code></pre>
  
  <p>pagebreak style:</p>
  
  <pre><code>&lt;style&gt;.pagebreak {page-break-after: always;}&lt;/style&gt;
  </code></pre>