Suppose I have
<table>
<tr>
<td><a class='ilink'> link text </a></td>
<td></td>
<td></td>
<tr>
<tr>
<td><a class='ilink'> link text </a></td>
<td></td>
<td></td>
</tr>
</table>
in the jquery code, after clicking the link, I want to highlight the entire table row that the link is in. But how can I find it?
You can do it with
.closest()like this:If you have a lot of rows, this would be more efficient (one copy of this vs. one for every
<a>):