title: Change background color of cells of table using jQuery
body: <p>I have got a table with 6 rows and x columns. I need to change background color of cells to color which contains in array. Index of color matches how many rows should be painted. I have next array of colors:</p>
  
  <pre><code>var arr = ["lightgreen", "orange", "red"];
  </code></pre>
  
  <p>And my jQuery script:</p>
  
  <pre><code>$.each(arr, function(index, val) {
  $("tr:eq(" + (index) + ")").css("background-color", val);
  });
  </code></pre>
  
  <p>This piece of code only paint first three rows in different colors.
  I need output table like this:</p>
  
  <pre><code>lightgreen lightgreen lightgreen lightgreen
  orange orange orange orange
  orange orange orange orange
  red red red red
  red red red red
  red red red red
  </code></pre>
  
  <p>My jsfiddle: <a href="http://jsfiddle.net/kvdokq13/" rel="nofollow">http://jsfiddle.net/kvdokq13/</a></p>