Friday, May 1, 2009

[jQuery] Invalid Argument Error (IE) when getting "width" property

The following script works fine in all other browsers (centering a
nested img). On IE I get the following error message:

Line: 13
Char: 12949
Error: Invalid argument.
Code: 0

I narrowed it down to the line:
var i = $("#tabs-1a").css("width");

It appears ie doesn't like the "width" property but I don't know why.

Here is the whole script for the page:

$(function(){
$("#FraudVideo").tabs();
$("#TipsNews").tabs();

var i = $("#tabs-1a").css("width");
var num = parseFloat(i,10);
var p = num-313;
var l = p/2;
$("#tabs-1a img").css("margin-left",l);

$(window).resize(function(){
var i=$("#tabs-1a").css("width");
var num = parseFloat(i,10);
var p = num-313;
var l = p/2;
$("#tabs-1a img").css("margin-left",l);
});
});

Here is the page:
http://www.wcassist.com/FraudCenter_1.html

Thanks a bunch!

John

No comments: