background-color only in Column

background-color only in Column

impex09impex09 Posts: 45Questions: 20Answers: 0

Hello, I put a condition in my script that depending on the status of the column, the background-color changes, but I only want the color of the column to change, not all the row, I am doing it in the following way,

if (data.cat_estatus.id_estatus ==2) {
$('td', row).css('background-color', '#f4d03f ');

Can somebody help me?

Thank you.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 17,759Questions: 25Answers: 4,216
    Answer ✓

    Try using:

    $('td:eq(2)', row).css('background-color', '#f4d03f ');
    

    Where the 2 is the column number.

    Kevin

  • impex09impex09 Posts: 45Questions: 20Answers: 0

    Excellent!!! thanks a lot

Sign In or Register to comment.