title: Javascript "check all" a subset of multiple checkbox groups
body: <p>My checkbox group are in html table. Each row has checbox group. I am trying to put a select_all button in each row of table (which can select all or unselect all the checkbox of that particular row). I used javascript for the purpose. However, select all button checks all the checkbxes of the table. I couldnt find a way to select_all button applicable to only single row. Any idea?</p>
  
  <p>I think the change in javascript can solve this prob, but I am unfamiliar with javascript orjquery.</p>
  
  <pre><code>function checkAll(bx) {
      var cbs = document.getElementsByTagName('input');
      for (var i = 0; i &lt; cbs.length; i++) {
          if (cbs[i].type == 'checkbox') {
              cbs[i].checked = bx.checked;
          }
      }
  }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form action="backend.php" method="POST" target="iframe_3"&gt; 
      &lt;table border="10" width="900" bordercolor="green"&gt;
          &lt;tr&gt; 
              &lt;td colspan="3"  style="background-color:#7F77AE"&gt;DNA&lt;/td&gt; 
              &lt;td&gt;&lt;input type="checkbox" name="check_list[]" value="value 1"&gt;seq&lt;/td&gt; 
              &lt;td&gt;&lt;input type="checkbox" name="check_list[]" value="value 2"&gt;codon&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" onclick="checkAll(this)"&gt;Select_all&lt;/td&gt; 
          &lt;/tr&gt; 
          &lt;tr&gt; 
              &lt;td colspan="3"  style="background-color:#7F77AE"&gt;RNA&lt;/td&gt; 
              &lt;td&gt;&lt;input type="checkbox" name="check_list2[]" value="value 3"&gt;seq&lt;/td&gt; 
              &lt;td&gt;&lt;input type="checkbox" name="check_list2[]" value="value 4"&gt;codon&lt;/td&gt; 
              &lt;td&gt;&lt;input type="checkbox" onclick="checkAll(this)"&gt;Select_all&lt;/td&gt; 
          &lt;/tr&gt; 
      &lt;/table&gt; 
  </code></pre>