I have the following code which needs to get the width of an image which is dynamically loaded, when a thumbnail is clicked on.
$("<img class='mypopupimage' src='" + imgSrc + "' style='padding:10px;' width='500' />").appendTo("div.mydiv");
var imgWidth = $(".mypopupimage").width();
The trouble I have is that the popup images are all different widths, but when I remove the width attribute from the image the imgWidth variable gets set to 0.
Any ideas?