使用Javascript 1更改背景颜色

时间:2017-10-11 02:49:07

标签: javascript css html5

如何有条件地更改背景颜色。

HTML:

<label class="control-label bold" id="lbstatus"></label>

JS:

if ($("#lbstatus").text() == "progress")
{
  //background color label change
}

1 个答案:

答案 0 :(得分:1)

使用jQuery css

 if ($("#lbstatus").text() === "progress")
 {
    $("#lbstatus").css("background-color", "blue");
 }
相关问题