Get auto height of a div without cloning it
<p>I have a div element whose auto height, lets say, is 300px.<br>
On a button click, I set it's height to 500px.<br>
I would like to animate it's height back to its default height.
The only solution I know is to clone the div, store its height and use it accordingly.<br>
A <a href="http://jsfiddle.net/nLtVz/" rel="nofollow">jsfiddle example</a></p>

<pre><code>var elem = $("div").clone().height("auto").appendTo("body");
$('div').animate({"height": elem.height()});
elem.remove();
</code></pre>

<p>Is there a better way to do it? I dont want to clone as I have huge number of elements on my actual page.</p>

<p>Update:
I have created <a href="http://jsfiddle.net/XUL9H/" rel="nofollow">another fiddle</a>. How would you get default height of element if its not yet set on load?</p>
