views:

210

answers:

2

i know there are many tangential posts on this topic (I've read them all) but i can't seem to put it all together.

I would like to highlight all rows whose 2nd column contains the '-' character.

in case its relevant:

1) the second column's header (th) is "Due In"
2) the values in the second column are strings
3) there isn't a specific class for the second column

Thanks
tj

+1  A: 
$("tr td:eq(1):contains('-')").parent().addClass("highlight");

@recursive : I changed the selector for the "eq", thanks.

Lucas
this works but only highlights the first row to match this criteria. How do I repeat for each row?
TJ
My approach works for all rows.
recursive
+2  A: 

The 2nd in Lucas' answer does not work for me in jquery 1.4, but this does:

$('tr').find('td:eq(1):contains(-)').parent().css('backgroundColor', 'yellow');
recursive