jQuery: “Could not get the display property. Invalid argument.” error in Internet Explorer 7


I’m really very new (using it for a week or two) to jQuery myself and this had me stumped for a few minutes. I got the error “Could not get the display property. Invalid argument.” in Internet Exploder 7 and not in Firefox 3.6 so typical :). I went through the usual troubleshooting method of commenting line by line I found the offending line.

It looked something like this

$("#helpdiv").animate({ position: "fixed", top: ($(window).height() - $("#helpdiv").height()) - 2 }, 2000);

So I commented out all the options between {} and added them back one by one and found that it was the position: “fixed” option that was causing the error.

Solution:

Remove the position: “fixed” option from the animate and set it with css then do the animate.

$("#helpdiv").css({ position: "fixed" });
$("#helpdiv").animate({ top: ($(window).height() - $("#helpdiv").height()) - 2 }, 2000);
Advertisements

3 thoughts on “jQuery: “Could not get the display property. Invalid argument.” error in Internet Explorer 7

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s