managemember.ui.js 687 B

123456789101112131415161718
  1. $(function()
  2. {
  3. $(document).on('change', 'input.check-all', function()
  4. {
  5. const checked = $(this).prop('checked');
  6. $(this).parents('.form-row').find('input[type=checkbox]').prop('checked', checked);
  7. });
  8. $(document).on('change', 'input[name^=members]', function()
  9. {
  10. let checked = true;
  11. const checkedCount = $(this).closest('.form-group').find('input[name^=members]:checked').length;
  12. const totalCount = $(this).closest('.form-group').find('input[name^=members]').length;
  13. if(checkedCount < totalCount) checked = false;
  14. $(this).closest('.form-row').find('input.check-all').prop('checked', checked);
  15. });
  16. });