Reputation: 11
I have this script:
$(document).ready(function(){
var search = 'foo';
$("table tr td").filter(function() {
return $(this).text() == search;
}).parent('tr').css('background-color','#f2dede');
});
What I want it to do is to color the background of the table whether the text is "foo" or "supfoo" or "foobar" or "foo foo". Anything with "foo" in it should be colored pink.
Not sure what to change! Please help...
Upvotes: 0
Views: 39
Reputation: 503
Could you use :contains()?
$( "tr:contains('foo')" ).css( "background-color", "red" );
Upvotes: 2