title: jQuery highlighting selected columns only in a table
body: <p>I see this post on <a href="https://stackoverflow.com/questions/494362/highlighting-columns-in-a-table-with-jquery">highlighting even columns</a> but can I highlight only selected columns?</p>
  
  <p>Here is the code they use:</p>
  
  <pre><code>$("table.Table22 &gt; tbody &gt; tr &gt; td:nth-child(even)").css("background","blue");
  </code></pre>
  
  <p>But I would like: NOTE: the <code>class="highlight"</code> will be on the selected columns, so if I selected column 3 the <code>class="highlight"</code> would be removed from column 2 and added to column 3. jQuery needs to add the class based on selected column.</p>
  
  <pre><code>&lt;table class="tbl"&gt;
      &lt;tr&gt;
          &lt;th class="firstColumn"&gt;
              Cell 1:Heading
          &lt;/th&gt;
          &lt;th class="highlight"&gt;
              Selected column so this should be highlighted
          &lt;/th&gt;
          &lt;th&gt;
              Cell 3:Heading
          &lt;/th&gt;
          &lt;th&gt;
              Cell 4:Heading
          &lt;/th&gt;
          &lt;th&gt;
              Cell 5:Heading
          &lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              Cell 1:Row 1
          &lt;/td&gt;
          &lt;td class="highlight"&gt;
              Selected column so this should be highlighted
          &lt;/td&gt;
          &lt;td&gt;
              Cell 3:Row 1
          &lt;/td&gt;
          &lt;td&gt;
              Cell 4:Row 1
          &lt;/td&gt;
          &lt;td&gt;
              Cell 5:Row 1
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              Cell 1:Row 2
          &lt;/td&gt;
          &lt;td class="highlight"&gt;
              Selected column so this should be highlighted
          &lt;/td&gt;
          &lt;td&gt;
              Cell 3:Row 2
          &lt;/td&gt;
          &lt;td&gt;
              Cell 4:Row 2
          &lt;/td&gt;
          &lt;td&gt;
              Cell 5:Row 2
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>