Hello ive got this code to check if a checkbox has been checked i want the user to at least check one checkbox, if they select none then an message should appear saying you havent selected any checkboxes. the user can only select up2 two checkboxes ive tried this code below and nothing is happening if any1 could help me plz
<script type="text/javascript">
function Check(){
var checkSelected = false;
for (i = 0; i < document.Dates.checkbox.length; i++)
{
if (document.Dates.checkbox.checked){
checkSelected = true;
}
if (!checkSelected)
{
alert('You didn't choose any of the checkboxes!');
return false;
}
}
}
</script>
<form name="Dates" action="send.php" method="post" onsubmit="return Check();">