title: Javascript count checked checkbox
body: <p>I know that may have a few similar questions @stackoverflow, but I didnt found any solution to my problem yet :s</p>
  
  <pre><code>&lt;?php
  while($rowVideo = mysql_fetch_array($ResultQueryVideo))
  {
  ?&gt;
  &lt;input type="checkbox" name = "checkbox-1[]" class="checkbox" value ="&lt;?php echo $rowVideo['idVideo'] ?&gt;" /&gt; &lt;?php....some code...
  </code></pre>
  
  <p>This results a few checkbox's, the same number as idVideo..thats the point.</p>
  
  <p>Now, before the submit, I need to be sure that at least one checkbox is checked. But i was not sucesseful :x</p>
  
  <pre><code>function isCountCheck (helperMsg) {
      var chkCnt = 0;
      var Frm = document.forms[0];
      var dLen = Frm.length - 1;
      for (i=0;i&lt;=dLen;i++) {
          if(document.form1.["checkbox-1[]"].checked) chkCnt++;
      }
  
      if (chkCnt&gt;0) {
          return true;
      } else {
          alert(helperMsg);
          return false;
      }
  }
  </code></pre>
  
  <p>Extra details:
  form name = "form1"</p>
  
  <p>Can you guide me a litle ?
  Thanks</p>
  
  <p>EDIT:</p>
  
  <pre><code>function isCountCheck(){
      if($("input[type=checkbox]:checked").length &gt; 0)
      {
      return true;
      }
      else
      {
      alert('Invalid');
      return false;
      }
  }
  </code></pre>
  
  <p>But still not working..even that alert is shown..</p>