How do I process only checked rows in table?
<p>Assuming I have the following table:</p>

<pre><code>&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Column 1&lt;/th&gt;
      &lt;th&gt;Column 2&lt;/th&gt;
      &lt;th&gt;Column 3&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;A1&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox"/&gt; A2&lt;/td&gt;
      &lt;td&gt;A3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;B1&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox"/&gt; B2&lt;/td&gt;
      &lt;td&gt;B3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;C1&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox"/&gt; C2&lt;/td&gt;
      &lt;td&gt;C3&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>I want to generate JSON from the table only for the rows whose checkbox is checked. What do I put in for "Insert Check Here"?</p>

<pre><code>var myRows = [];
var $headers = $("th");
var $rows = $("tbody tr").each(function(index) {
  $cells = $(this).find("td");
  myRows[index] = {};
  $cells.each(function(cellIndex) {
    // Insert Check Here
    myRows[index][$($headers[cellIndex]).html()] = $(this).html();
  });    
});

var myObj = {};
myObj.myrows = myRows;
alert(JSON.stringify(myObj));​
</code></pre>
