Thanks. I’ve changed to height. But I used single <img> tag before (without width and height), then I rewrite whole tag few times. It didn’t work and it doesn’t work now.
About more context. The div element is in HTML body:
Your code worked okay for me with a different image. Try changing the image used to another you know exists. If that works then it’s the image address that’s the problem.
function showWaitImage() {
var div = document.getElementById("image");
var sp = document.createElement("span");
var im = document.createElement("img");
im.src = "http://...";
sp.appendChild(document.createTextNode("Uploading..."));
sp.appendChild(im);
div.appendChild(sp);
}
Try something like the above.
If it still doesn’t work, your URL is dodgy.
I know this is an old post and u must have found ur way out by now, but just updating the post for future followers who,like me ,came upon this post.
I think the problem is that, ur tryin got set the image right before a form submit.The form once submitted doesnt allow new server requests (even an image file).Even though u were settin the innerHTML before the submit,the javascript engine doesnt wait for the image to actually load before going to the submit().And the submit locks the page.So u neither get an image broken error or get to see the image.
Solutions:
Prefetching the image when the page loads.
set the innerhtml when the page loads and hide the div, and toggle the display/visiblitiy property when u submit.