Nagaraj
Nagaraj

Reputation: 145

Highlight entire row with some color Jquery

I am using Jquery datatable. Using Json object i have feed the values in a table. In a table i have value as "FAX" in some cells. My question is i want to highlight entire row with some color which is having "FAX" value in a Table. I have tried below mentioned code but its not working for me

$("#pagination_table tr td:contains('FAX')").css('background','red');

Upvotes: 1

Views: 506

Answers (2)

Konstantin Dinev
Konstantin Dinev

Reputation: 34915

The correct name of the css property is background-color, also the entire row is the parent element.

$("#pagination_table tr td:contains('FAX')").parent().css('background-color','red');

Upvotes: 1

James Ellis-Jones
James Ellis-Jones

Reputation: 3092

Also that code will only highlight the table cell, you would need

$("#pagination_table tr td:contains('FAX')").closest('tr').css('background-color', 'red');

Upvotes: 4

Related Questions