Change Row Color based on td value using Jquery

后端 未结 2 427
再見小時候
再見小時候 2021-01-12 18:12

I have a table that gets populated from a database. I have 2 conditions that i need to apply

  1. Apply Zebra striping to the Table (Completed)
  2. Change Row
2条回答
  •  逝去的感伤
    2021-01-12 18:32

    Try this,

    Live Demo

    $('td.status[value=Zero]').css('background-color', 'red');
    

    Edit: Based on comments and change in OP

    To change the whole row with the given criteria of td you can do it this way.

    Live Demo

    $('td.status[value=Zero]').closest('tr').css('background-color', 'red');
    

提交回复
热议问题