If I do this:
test();
function test(){
$('img').load(function(){
alert(this.width);
})
}
An alert is shown with the correct image width.
But, when I do this:
alert(test());
function test(){
$('img').load(function(){
return this.width;
})
}
... the alert shows 'undefined'
Both examples are run from within the $(document).ready function. I think it got something to do with load(). But I can't figure out why alert works, but return doesn't.
thx!