Niveditha
Niveditha

Reputation: 115

var issue in IE-8

While assigning a value for a variable, the variable is taking wrong value. The code is

var txtColor = $(".menu-item").css("background-color");

Where $(".menu-item").css("background-color"); represents pink color. But txtColor is taking as "transparent".

I'm seeing this issue only in IE-8.

Can anyone help me in fixing this issue.

Thanks in advance.

Upvotes: -1

Views: 38

Answers (1)

Josh
Josh

Reputation: 3288

Question, is your CSS set up like this?

background: pink;

If so, try using $('.menu-item').css("background"); instead.

Old versions of IE will not properly cascade group definitions (like background) to the other settings. In modern browsers, defining background as "pink" will also set the background-color to "pink".

Upvotes: 0

Related Questions