How can I access the value of imgWidth? This is giving me undefined.
somejQueryMethod(function() { 
    var imgWidth;
    $("<img/>").attr(
        "src", 
        $("#SomeImgSelector").attr("src")
    ).load(function() {
        imgWidth = this.width;
    });
    // use imgWidth here
    // imgWidth is undefined here
});
Background info: From this SO question I assumed that as
imgWidthwas being defined outside of theload()method, it would always be available outside ofload(). Which makes me wonder why defineimageWidththere and not inload()?
 
     
     
     
    