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