So, I have six checkboxes, one of which is checked as default. The user is only allowed to check two checkboxes at a time, and this works fine. However, the if the default checkbox is checked, no other should be checked. This is what's giving me issues. I found this post and tried working from that.
So, I have 5 checkboxes with class other and one checkbox with id default. My problem is that I can't get it to check default when none of the others are checked.
Here's a JSFiddle with the code — can you guys push me in the right direction?
Here's my code:
HTML:
<input type="checkbox" group="checkboxes" name="other" class="other" id="one">
  <label for="one">One</label><br />
<input type="checkbox"  group="checkboxes" name="other" class="other" id="two">
  <label for="two">Two</label><br />
<input type="checkbox" group="checkboxes" name="other" class="other" id="three">
  <label for="three">Three</label><br />
<input type="checkbox" group="checkboxes" name="other" class="other" id="four">
  <label for="four">Four</label><br />
<input type="checkbox" group="checkboxes" name="other" class="other" id="five">
  <label for="five">Five</label><br />
<input group="checkboxes" type="checkbox" checked="checked" name="other" id="default">
  <label for="default">Default</label>
jQuery:
$('.other').change(function(){
    var c = this.checked ? false : true;
    $('#default').attr('checked', c);
});
$(document).ready(function(){
    var maxaids = "2";
    $(document).on('click', "input[type=checkbox]", function(){
        var bol = $("input:checked").length >= maxaids;
        $("input[type=checkbox]").not(":checked").attr("disabled",bol);
    });
});
 
     
     
     
     
     
    