$("td").each(function () {
if($(this).css("background-Color")=="red") {
$(this).text()=="dd";
}
else if($(this).css("background-Color")=="blue") {
$(this).text("aa");
}
});
代码应该怎样写才正确?
最佳答案
您可以像这样比较红色:
if($(this).css("background-Color")=="rgb(255, 0, 0)"){
....
}
和蓝色:
if($(this).css("background-Color")=="rgb(0, 0, 255)"){
....
}
关于javascript - jQuery如何使用td背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22438930/