how do I filter table rows with specific values in jQuery?
<p>I would like to be able to get a count of all rows checked where a cell has a specific value. So if given the below table, the user checks the checkbox next to row 1, I would get the following.</p>

<p>bonus rows selected = 1
base rows selected = 0</p>

<p>if I check the box next to row 2 I would get the following values</p>

<p>bonus rows selected = 2
base rows selected = 0</p>

<p>and if I uncheck the 2nd row, and check the third, I would get...</p>

<p>bonus rows selected = 1
base rows selected = 1</p>

<p>I can get the total number of rows selected in this way...</p>

<pre><code>$(function(){
var $ck = $('input[type=checkbox]');
    $ck.filter(':checked').length;
)};
</code></pre>

<p>Can I chain selectors together somehow? This doesn't work, but is what I thought of...</p>

<pre><code>m1 = $ck.filter(':checked')
               .parents('tr:first')
               .filter('.type')
               .text('Bonus')
               .length;
alert(m1); // returns 0
</code></pre>

<p>Here's a sample table</p>

<pre><code>&lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
        &lt;th&gt;Points&lt;/th&gt;
        &lt;th&gt;Bonus&lt;/th&gt;
        &lt;th&gt;&amp;nbsp;&lt;/th&gt;
    &lt;/tr&gt;   
&lt;/thead&gt;
&lt;tbody&gt;
    &lt;tr&gt;
        &lt;td class=".points"&gt;10&lt;/td&gt;
        &lt;td class=".type"&gt;Bonus&lt;/td&gt;
        &lt;td class=".chkbox"&gt;&lt;input type="checkbox"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class=".points"&gt;20&lt;/td&gt;
        &lt;td class=".type"&gt;Bonus&lt;/td&gt;
        &lt;td class=".chkbox"&gt;&lt;input type="checkbox"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class=".points"&gt;10&lt;/td&gt;
        &lt;td class=".type"&gt;Base&lt;/td&gt;
        &lt;td class=".chkbox"&gt;&lt;input type="checkbox"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class=".points"&gt;20&lt;/td&gt;
        &lt;td class=".type"&gt;Base&lt;/td&gt;
        &lt;td class=".chkbox"&gt;&lt;input type="checkbox"&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;/tbody&gt;
</code></pre>

<p> </p>
