After loading an internal div (#book_table) via ajax, I want to resize the width of the body to accommodate the larger content.
var new_width = parseInt($('#book_table').css('width'))+407;
$('body').width(new_width);
Works in FF and Safari, but fails in IE with “Invalid argument”. In the unpacked jQuery 1.3.1, it’s line 1049:
elem[ name ] = value;
Passing a literal value, however, works in IE:
$('body').width(1200);
You should try:
Using
css('width')is returning a string with the ‘px’ extension rather than simply a number. Firefox can properly parse"100px"to be100withparseInt, but it looks like IE does not.Using
width()will just return an integer, which also removes the need to callparseInt.