Checkbox Validation Required Form
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> <body> <script> $(function () { var requiredCheckboxes = $('.options :checkbox[required]'); requiredCheckboxes.change(function () { if (requiredCheckboxes.is(':checked')) { requiredCheckboxes.removeAttr('required'); } else { requiredCheckboxes.attr('required', 'required'); } }); }); $(function () { $("#c").click(function () { if ($("input[type=checkbox]").is(":checked")) { $("#a").prop('checked', false); $("#b").prop('checked', false); $("#d").prop('checked', false); $("#a").attr("disabled", true); $("#b").attr("disabled", true); $("#d").attr("disabled", true); } else { $("#a").attr("disabled", false); $("#c").attr("disabled", true); $("#d").attr("disabled", false); $("#b").attr("disabled", false); } }); }); </script> <form> <div class="form-group options"> <input type="checkbox" name="type[]" id="a" value="A" required /> Sms <input type="checkbox" name="type[]" id="b" value="B" required /> Email <input type="checkbox" name="type[]" id="d" value="D" required /> Telefon <input type="checkbox" name="type[]" id="c" value="C" required /> Hiçbiri <input type="submit" /> </div> </form> </body> </html>