I'm making a form using HTML5 validation features.
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Form Test</title>
</head>
<body>
<form id="form1" method="post" action="">
<label><input type="checkbox" name="color1" value="1" required />Green</label><br />
<label><input type="checkbox" name="color2" value="2" required />Red</label><br />
<label><input type="checkbox" name="color3" value="3" required />Yellow</label><br />
<label><input type="checkbox" name="color4" value="4" required />Blue</label><br />
<input type="submit" /><input type="reset" />
</form>
</body>
</html>
I need it to validate if at least one checkbox is checked.
"Must have at least one checkbox checked."
I found answer here:
Jquery - check if at least one checkbox is checked
Check if at least one checkbox is checked using jQuery
Making sure at least one checkbox is checked
Submit form only if at least one checkbox is checked
But using JavaScript, jQuery and etc.
Is possible make using HTML5 only?