Change colour of table cells depending on value

前端 未结 3 1592
走了就别回头了
走了就别回头了 2021-01-26 12:53

I\'m using jQuery to edit the background-color of table cells. My code is as follows (the each cell has numbers in the format \"x/y\" so I mine them out at the star

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-26 13:29

    Thanks Nunners, there were header values that broke the code. I've fixed it using the following if block:

    if(vals[1] == undefined){
        return true;
    } else{
        //change colour
    }
    

提交回复
热议问题