Getting height from div using JQuery

Getting height from div using JQuery

I have two divs.  One is populated by a checkbox input and some wrapped text.  The other is empty.
I wanted to set the height for the second div to equal the first div.  This seemed quite easy to me. Merely
  1. $('#divBlankReqNum').height($('#div' + lastReqID.toString()).height());
When this didn't work I entered this code

  1. var heightValue = $('#div' + lastReqID.toString()).height();
  2. alert(heightValue);
  3. $('#divBlankReqNum').height(heightValue);
  4. var heightValue = $('#divBlankReqNum').height();
  5. alert(heightValue);
Much to my surprise the alert showed the height of the first div to be 0.

But when I checked the JQuery web site for .height() it seemed to indicate that the height returned was the actual height of the element not contents of the style "height".

So I don't know what I am doing wrong here.  I welcome any ideas.