Lost variable somewhere?
<p>I have the following:</p>

<pre><code>var element = $(this);
var divName = element.parents("div:eq(0)").attr("name");
$.each(boxInfo,function(i,n) {
    if( n.boxName == divName )
    {
        var newHeight = n.boxHeight;
    }
});

clicked.parents("div:eq(0)").animate({
    height: newHeight + 'px'
}, 1000);
</code></pre>

<p>Problem being "newHeight undefined". But if I do this:</p>

<pre><code>var element = $(this);
var divName = element.parents("div:eq(0)").attr("name");
$.each(boxInfo,function(i,n) {
    if( n.boxName == divName )
    {
        alert(n.boxHeight);
        var newHeight = n.boxHeight;
    }
});

clicked.parents("div:eq(0)").animate({
    height: newHeight + 'px'
}, 1000);
</code></pre>

<p>it returns the height. How is it that 5 lines down the variable is undefined?</p>
