.offsetwidth, .width, .width() Etc. Not Always Returning Properly On Auto-sized Element
I'm trying to resize a div based on the width of an image contained within it, but no JS method for grabbing the image's width seems to be working consistently.
).on('load', function() {
var newWidth = $(".wp-post-image").first().width();
$(".wp-post-image").parent(".main_image").css("width", newWidth);
});
Post a Comment for ".offsetwidth, .width, .width() Etc. Not Always Returning Properly On Auto-sized Element"