How do you write this so it runs faster. It looks like because I’m using an each() it is slowing it down.
Can I use filter()?
$("#X tr").each(function () {
if ($(this).find("table td:eq(1)").text() == "a") {
$(this).css("background":"red");
}
});
<table id = "X">
<tr >
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
<tr >
<td></td>
<td></td>
<td></td>
</tr>
...
<tr >
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
</table>
thanks
You can use the
:containsselector: http://jsfiddle.net/Af6Nz/1/.