Change <tr> background when child <td> contains "specific text" with jquery
jquery
Solution
Apply `css` to siblings of `td` instead of `tr` and also use andSelf() if you want to include current td.
$('.status:contains("Complete")').siblings().andSelf().css('background', '#dff0d8');
If you are using jQuery 1.8 + then use andBack instead of andSelf.
The andSelf function has been deprecated and is now an alias for .addBack(), which should be used with jQuery 1.8 and later, reference.
Problem
I am basically wanting to change the background color of a `<tr>` based on the contents of one `<td class="status">` in the row. I've tried this, amongst numerous other things ``` $('.status:contains("Complete")') .parent() .css('background', '#dff0d8'); ``` The code below works fine on it's own to color the `<td>` ``` $('.status:contains("Complete")') .css('background', '#dff0d8'); ``` But the .parent() is not working to color the row. Any help much appreciated.