This is a fragment of my code. Can I add an ID to this portion? Now I have 2 groups of check boxes (topic, interests). When I check the box in the group and I do not check the box in the second group, an error message appears.
My idea: add ID to this "input [type = checkbox]: selected" and add all of it to IF. Is it possible to do it ?
Under the text is my idea what it should look like:
#I know it doesn't work.
if(($('input[type=checkbox][id=subject]:checked').length == 0) && $('input[type=checkbox][id=interests]:checked').length == 0))
<script>
function validate_form()
{
valid = true;
if($('input[type=checkbox]:checked').length == 0)
{
document.getElementById("status").innerHTML = "Please tick one box for interests and topics";
valid = false;
}
return valid;
}
</script>