To prevent form submission and display an error message if checkbox id="check1" is selected, follow the code below:
<form name="form1" method="post" action="">
<span id="group">
<input type="checkbox" name="check1" id="check1" value="1">
<label>check1</label> <br>
<input type="checkbox" name="check2" id="check2" value="2">
<label>check2</label> <br>
<input type="checkbox" name="check3" id="check3" value="3">
<label>check3</label> <br>
<input type="checkbox" name="check4" id="check4" value="4">
<label>check4</label> <br>
<span id="error-message" class="error" style="display: none;">One or more of your selection is wrong.</span>
</span>
<input name="submit" type="submit" value="submit" onclick="validateForm()">
</form>