循环为每个表格td设置不同的样式

$( "table tr:gt(0)" ).each( function (i){
     alert( "这是第" +i+ "行内容" );
     $( this ).children( "td" ).each( function (i){
         alert( "第" +i+ "个td的内容:" +$( this ).text());
          if ($(this).text() == "计划"){
            $(this).css("background-color","red")
    }
     });
});

猜你喜欢

转载自blog.csdn.net/weixin_38951735/article/details/80951963