title: get background color of a css class applied to an element
body: <p>Say, I have the following CSS class:</p>
  
  <pre><code>.upComing{ background:#ccc; font-weight:bold; }
  </code></pre>
  
  <p>and in my HTML I have a table which some rows have that class applied, like so:</p>
  
  <pre><code>&lt;table&gt;
    &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt;
    &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt;
    &lt;tr class='upComing'&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt;
    &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt;
    &lt;tr class='upComing'&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>so far, so good, but via JavaScript I have events that listen on td clicks and I want to get the color of the row (I know I can get the class of the row, but in this case I need to be able to get the color from the class).</p>
  
  <p>I need to do this because the table can be exported to an excel file and the row colors don't get applied on the excel file if they're on a CSS class, I want to apply this color to each td before sending the html to the excel generator.</p>
  
  <p>PS: the table is dynamically generated from a jQuery plugin we created, it's still a work in progress, but when we feel confident enough with it we'll release it for the public.</p>
  
  <p>--Update--
  Here's an update on this topic, there's indeed a pure javascript solution for this, I had to take a dive into jQuery's source code to check this. Here's the solution:</p>
  
  <p>1) point to the desired element</p>
  
  <pre><code>var tr = $("tr.upComing").first()[0]; 
  </code></pre>
  
  <p>2) get the COMPUTED STYLE of the element</p>
  
  <pre><code>var css = window.getComputedStyle( tr );
  </code></pre>
  
  <p>3) get the PROPERTY VALUE of the COMPUTED STYLE</p>
  
  <pre><code>var color = css.getPropertyValue( "background-color" );
  </code></pre>
  
  <p>As of this moment I've only tested in FF, Safari, Chromium and Opera on a Mac, if someone could try this on IE and give us feedback that'll be grand.</p>