title: jQuery: check if column contains TD with certain class
body: <p>I am using the following lines to create an array of all TDs matching a certain search term. If a TD contains my search term then it has the class "<code>highlight</code>" added. </p>
  
  <p>The below works fine so far my only problem is that I need to add 0 if one column does not contain my search term (a column either has the value or not but it cannot appear more than once in the same column). </p>
  
  <p>The columns in question are columns <code>2, 4, 6, 8, 10, 12</code> so my array should always contain 6 values and just show 0 if one of these columns does not contain the search term. </p>
  
  <p>In other words: I need to check whether a column contains a TD with the class "highlight" or not. </p>
  
  <p><strong>My function:</strong> </p>
  
  <pre><code>var arr = new Array();
  $('.highlight').each(function() {
      arr.push($(this).text());
  });
  </code></pre>
  
  <p><strong>Example HTML:</strong> </p>
  
  <pre><code>&lt;table id="myTable"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th class="mayContainHighlight"&gt;&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th class="mayContainHighlight"&gt;&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th class="mayContainHighlight"&gt;&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th class="mayContainHighlight"&gt;&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th class="mayContainHighlight"&gt;&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th class="mayContainHighlight"&gt;&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td class="mayContainSearchTerm highlight"&gt;search term&lt;/td&gt;
              &lt;td&gt;5&lt;/td&gt;
              &lt;td class="mayContainSearchTerm highlight"&gt;search term&lt;/td&gt;
              &lt;td&gt;7&lt;/td&gt;
              &lt;td class="mayContainSearchTerm highlight"&gt;search term&lt;/td&gt;
              &lt;td&gt;3&lt;/td&gt;
              &lt;td class="mayContainSearchTerm"&gt;other data&lt;/td&gt;
              &lt;td&gt;1&lt;/td&gt;
              &lt;td class="mayContainSearchTerm highlight"&gt;search term&lt;/td&gt;
              &lt;td&gt;5&lt;/td&gt;
              &lt;td class="mayContainSearchTerm"&gt;other data&lt;/td&gt;
              &lt;td&gt;1&lt;/td&gt;
          &lt;/tr&gt;
          // more TRs...
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Hope someone can help me with this. Many thanks in advance, Tim.</p>