title: change background color of table row clicked
body: <p>I am trying to highlight the row of the last item clicked. Tried some jquery code found in searches and none of it even tries to work. Must be doing something basic wrong. Here's a jsfiddle with one solution tried: <a href="http://jsfiddle.net/birchy/he9ts/1/" rel="nofollow">http://jsfiddle.net/birchy/he9ts/1/</a></p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt;====&gt;&lt;/td&gt;
  &lt;td class='msgRow' onclick='loadMsg();'&gt;Content1&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;====&gt;&lt;/td&gt;
  &lt;td class='msgRow' onclick='loadMsg();'&gt;Content2&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;====&gt;&lt;/td&gt;
  &lt;td class='msgRow' onclick='loadMsg();'&gt;Content3&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;====&gt;&lt;/td&gt;
  &lt;td class='msgRow' onclick='loadMsg();'&gt;Content4&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  
  function loadMsg()
  {
  alert('row clicked');
  $(this).closest("tr").css('background-color','green');
  $(this).css('background-color','red');  
  }
  </code></pre>