I have a problem with IE8 ,I am getting the height of the object 0. It works fine in FF and chrome.
var value = obj.prop("height");
prop() doesnot work with IE or, the height is 0 because the obj is a hidden image tag.
Any help?
I have a problem with IE8 ,I am getting the height of the object 0. It works fine in FF and chrome.
var value = obj.prop("height");
prop() doesnot work with IE or, the height is 0 because the obj is a hidden image tag.
Any help?
I'm going to assume that you are trying get the height attribute from your img tag that look something like this.
<img src="http://placehold.it/350x350" width="350" height="350" style="display:none;">
Note the width and height attribute.
If you're trying to get the height attribute value in the img tag, try using .attr() like so
var value = obj.attr("height");
Another note is that the image might not be loaded and as a result is acting weird on IE8. Try to make sure the image is loaded before getting the height.
For this matter, see explanation about document.ready and window.load.
However, as many have said, you should be using .height() to get the height of an element.
.prop is a jquery function you need to include jquery in your page
http://api.jquery.com/prop/
for chrome and firefox you might have it it your browser's cache i think thats wht its working...