How to set an event on the parent element using jQuery
<p>help me figure out how to set an event on the parent element (<code>&lt;tr&gt;</code>)
I can't find the error in the condition</p>

<pre><code>&lt;script type="text/javascript"&gt;
$('table tbody tr').each(function(){
     $(this).find('a:first').click(function(){
        if($(this).parents().get(1).tagName == 'TR') {
         $(this).parents().get(1).find('tr').css('background', 'red'); //What's wrong?
        }
});
&lt;/script&gt;

&lt;table&gt;
   &lt;tbody&gt;
      &lt;tr&gt;
         &lt;td&gt;&lt;a href="#"&gt;text&lt;/a&gt;&lt;/td&gt;
         &lt;td&gt;text&lt;/td&gt;
      &lt;/tr&gt;
   &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>Unfortunately, the formatting, I don't see any more special tag</p>
