My sample HTML
<tr>
<td>
<div><span id="temp" />
</div>
</td>
</tr>
<tr>
<td>
<div><span id="temp" />
</div>
</td>
</tr>
From the Span tag how do i get the Table tr tag and set its background color ? Any easy methods rather than finding parent.parent?
And only the particular span tag TR should be changed not all the table TR ?
Thanks
$('#temp').parents('tr').css('background-color', 'red');.closest()instead of.parents(), will return only the closest tr.