I have the following:
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);
Problem being "newHeight undefined". But if I do this:
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);
it returns the height. How is it that 5 lines down the variable is undefined?