I have a long base64
type string that I get and I would like to set as src
images
$('#img').attr('src',base64data) console.log('height - ' $('#img').height()); console.log('width - ' $('#img').height());
It looks like im is returning 0
for height
and width
. Of course, if I wait a while I will get the right height.
The thing .attr()
does not have a callback, how would I get information about getting the height and width after the src
attribute is set, without returning 0
back. (I think I get 0 because the change in jQuery happens asynchronously, but I cannot be sure)
source share