How to Get the Hidden Item Height

advertisements

This question already has an answer here:

  • jQuery: Get height of hidden element in jQuery 15 answers

I have hidden element in my webpage, I need to get height of that element. I have tried with .clientHeight, offsetHeight, .height(), and window.getComputedStyle but non of this working in attached scenario. Is there any trick to get height without adding any plugin. fiddle

HTML

<div class="frame">
<p>some text some text some text some text</p>
</div>

Jquery

$('p').height()


var p = $('.frame p').clone().css('display', 'none');
$('body').append(p);
alert(p.height()); // 19
p.remove();

Working example: http://jsfiddle.net/D9PyE/