.width returning zero on occasion??
I have a weird bug that's occuring in pretty much all the browsers. If I close the tab, and then hit Ctrl -> Shift -> T to bring it back the width() method returns 0 on an appended image instead of what the image actually is. Hitting refresh on the tab removes this bug and everything works fine. I will also say that trying .css('width') and
document.getElementById('divShadowLeft'); both also return 0 for this bug.
I can't show all the code for security reasons, but I'll just outright ask.. what are the reasons that width() would return 0 on an image?
I've checked to make sure that it was visible (both display and visibility properties), and I checked the length of the property to ensure it was there. I just can't figure out why width() is returning 0.
Any ideas? Here's a code snippet:
- $(this).append('<img src="'+defaults["imagePath"]+defaults["imageLeft"]+'" alt="" id="'+defaults["imageClass"]+'Left" class="'+defaults["imageClass"]+'" style="" />');
- alert('Length: '+$('#divShadowLeft').length+' | Width: '+$('#divShadowLeft').width()+' | Visible: '+$('#divShadowLeft').css('visibility'));