title: Limit checkboxes selection per table row
body: <p>I'm trying to limit selected checboxes by 3 per table row, using JS. Each row has an separated checkbox and 5 levels, which can be selected only 2, as in:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;
          &lt;input type="checkbox" name="indicator[]"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="checkbox" name="graduations[]"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="checkbox" name="graduations[]"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="checkbox" name="graduations[]"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="checkbox" name="graduations[]"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="checkbox" name="graduations[]"&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>The actual code is as seen on <a href="http://www.javascriptkit.com/script/script2/checkboxlimit.shtml" rel="nofollow">http://www.javascriptkit.com/script/script2/checkboxlimit.shtml</a>:</p>
  
  <pre class="lang-js prettyprint-override"><code>function checkboxlimit(checkgroup, limit){
      var checkgroup=checkgroup
      var limit=limit
      for (var i=0; i&lt;checkgroup.length; i++){
          checkgroup[i].onclick=function(){
          var checkedcount=0
          for (var i=0; i&lt;checkgroup.length;checkedcount+=(checkgroup[i].checked)? 1 : 0
              if (checkedcount&gt;limit){
                  alert("You can only select a maximum of "+limit+" checkboxes")
              this.checked=false
              }
          }
      }
  }
  </code></pre>
  
  <p>I could only limit for entire table. Is there a easy way to do this?</p>