Can’t get image width or height using javascript in IE 7 and 8

Came across this one whilst working with an TinyMCE plugin.

I had some additional css on the image i was trying to get the height and width of – display:none;

That’s the problem. Just use visibility:hidden; in your CSS and all will be fine in the world.

Oh just in case you are using the incorrect javascript as well.

alert(document.getElementById(‘imageId’).width);

Enjoy!

You can leave a response, or trackback from your own site.

Leave a Reply