How to get width of a div in pixels using JQuery (IE)
- by Casidiablo
Hello there.
At first glance it sounds easy... when using JQuery one can use the .width() method to retrieve the width of an element. The problem comes when the DIV element does not have its size in pixels but in words like 'auto' or 'inherit'.
When I do this it works nice in Firefox and Chrome even if the size is specified in words:
alert($('#id_div').css('width')); // these two sentences does not
It returns something like: 96px. But, IE returns the word 'auto'. I need to know the size it has in pixels because I have to do some calculations with that number... so, I've been wondering how to solve this problem. How can I solve this issue?
Thanks for reading.