I've been looking through posts trying to find the answer, but haven't had any luck, so hoping someone can point me in the right direction.
When I use the following code, it checks all the input boxes and it unchecks them. However, if I click the check all again, it doesn't check them all. Why is that?
JQuery
  $('document').ready( function() {
    $('.check_boxes').click( function() {
      if ( $(':checkbox').attr('checked')) {
        $(':checkbox').attr('checked', false);
      } else {
        $(':checkbox').attr('checked', true);
      }     
    });
});
HTML
<input type="checkbox" class="check_boxes" id="check_all" />
 
     
     
    