title: Jquery changing table cell colour
body: <p>I have been trying to get this working on my own, and have now given up. I got majority of the code off SO and other sites I Googled.</p>
  
  <p>What I am trying to do is change the <code>background-color</code> of my first <code>&lt;td&gt;</code> based on the value of my last <code>&lt;td&gt;</code> </p>
  
  <p>This is what I have at the moment, but I cant seem to get any other colour working other than the first <code>if statement</code> :(</p>
  
  <pre><code>$(document).ready(function() {
      $("#tableData tr:not(:first)").each(function() {
      //get the value of the table cell 
      var Colour = $(this).find("td:nth-child(4)").html();
      alert(Colour);
      //check the colour
      if (Colour == "red") {
          //change the color of the background
          $(this).find("td:nth-child(1)").css("background-color", "red");
      }
      else if (Colour == "green") {
          $(this).find("th:nth-child(1)").css("background-color", "green");
      }
      else if (Colour == "blue") {
          $(this).find("th:nth-child(1)").css("background-color", "blue");
      }
  
      });
  });
  </code></pre>
  
  <p>I have also created a <a href="http://jsfiddle.net/5gcvoqfn/1/" rel="nofollow noreferrer">FIDDLE</a> for you to see what I am experiencing. Please could you let me know how I have this change dynamically based on the cell value?</p>
  
  <p>Thanks!
  Mike</p>