开发者

setting background-color in IE via Jquery

开发者 https://www.devze.com 2023-03-22 19:36 出处:网络
I am trying to set a divs background color via var color = \"#FF0000\"; $(\'#main_con开发者_开发知识库tent_bg\').css(\'background-color\', color);

I am trying to set a divs background color via

var color = "#FF0000";
$('#main_con开发者_开发知识库tent_bg').css('background-color', color);

This works everywhere except IE (I have 8 installed);

The only thing I can think of is that I need to cast the color value to a number somehow.

Does anyone know why this wouldn't work?

thanks


Why Dont you try with

$('#main_content_bg').addClass("The Class that set color");

0

精彩评论

暂无评论...
验证码 换一张
取 消