title: how to dynamically change a table row background color when a link value within its cell changes when clicked
body: <p>I have been onto this for days and i seem not to be able to break even. I have a table that deplays a series of links in one of its cell - the last cell that is.
  Now  when  clicked ,the  text value in the last link changes(implemented with jsf ajax), to reflect the status of the row it resides in ,from 'suspend' to 'resume'  and vice versa. i have used jQuery to change the background 
  color of a row whenever the document is loaded and the text link reads 'resume'. See below on how i have implemented this</p>
  
  <pre><code>var defaultval;
  
  $(" table tbody tr td:nth-child(7)").each(function() {
      defaultval = $(this).find("a:nth-child(4)").html();
      if (defaultval == "resume") {
          $(this).parents("tr").addClass("suspended")
      }
  
  });​
  </code></pre>
  
  <p>Now i want this row background color to change whenever the link is clicked and its text value changes to 'resume' ,so i wrote JQuery code below</p>
  
  <pre><code>$("table tbody tr td:nth-child(7) ").click(function() {
      if ($(this).find("a:nth-child(4)").html() !== "resume") {
          $(this).parents("tr").addClass("suspended");
      }
      else {
          $(this).parents("tr").removeClass("suspended");
      }
  });​ 
  </code></pre>
  
  <p>It seemed to work when i click on the link. But the problem is that when the cell itself and other links within the cell
  are clicked it changes without the the text of the link changing because of the implementation above.
  And when i do this:</p>
  
  <pre><code>$("table tbody tr td:nth-child(7) a:nth-child(4)").click(function() {
      if ($(this).html() !== "resume") {
          $(this).parents("tr").addClass("suspended");
      }else {
          $(this).parents("tr").removeClass("suspended");
      }
  });​
  </code></pre>
  
  <p>It changes once and does not change back with further clicks.
  Now i want to restrict this effect to only when this link is clicked.Thanks in anticipation of your Response(s).</p>