detect keyword and add class
I want detect if the column has red or blue, add the class on it, it's like
- $('table tr').each(function() {
$(this)
.find('td:contains("red")')
.addClass('red')
.end()
.find('td:contains("blue")')
.addClass('blue');
});
but I want every column 2 below red column and column 3 below blue also add the same css, how to do it?
| |
|
red |
blue |
| 0 |
1 |
2 |
3 |
| 0 |
1 |
2 |
3 |
| 0 |
1 |
2 |
3 |