JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tbody>
<tr>
<td><a href="#">text</a></td>
<td>text</td>
</tr>
</tbody>
</table>
JavaScript
$('table tbody tr').each(function(){
$(this).find('a:first').click(function(){
if($(this).parents().get(1).tagName == 'TR') {
$($(this).parents().get(1)).css("background-color", 'red'); //What's wrong?
}
});
});