I wrote jQuery code that reads the width of columns in a table and applies them to another table.
On my page there is a TABLE:
<table style='table-layout:fixed;'> <tbody id='myTableBody'> <tr> <td style='width:100px;'>foo</td> <td style='width: 40px;'>bar</td> </tr> </tbody> </table>
I wrote the following jQuery code to read the css width properties of this table:
var colWidths = []; var cells = $('#myTableBody').find('td'); for (i = 0; i < cells.length; i++) colWidths.push($(cells[i]).css('width'));
After running the code, I expect colWidths be [100, 40] , and in FireFox it is. However, in IE8 it is [92,32] . This breaks my page in IE, which depends on the correctness of the values.
I believe it might be appropriate that my table is contained in the jQuery-ui-tabs element, and I know that jQuery-ui css can do strange things, so I wonβt be surprised if this has something to do with it.
Why doesn't jQuery.css ('width') return the value I expect in IE8? What can i do with this?
source share