How can I make it so the JS function will check that there are at least
2 checkboxes checked and a maximum of 5 checked ?
Is there a way to even do this ? I can have a multiple checkboxes of the same name on the page.
[CODE]
<script language=”JavaScript”>
function ValidateCompare(){
if (document.getElementById(“compare”).checked==false) {
alert(“Check between 2 and 5 checkboxes.”)
return false }
}
</script>
[code=html]
<a onclick=”return ValidateCompare();” id=”btnCompare”>Compare</a>
<form name=”form1″>
<input type=”Checkbox” name=”compare” id=”compare” value=”1″ />
<input type=”Checkbox” name=”compare” id=”compare” value=”5″ />
<input type=”Checkbox” name=”compare” id=”compare” value=”8″ />
<input type=”Checkbox” name=”compare” id=”compare” value=”10″ />
</form>