(function ($) { // Ensure parent category is bold only if it has children $('.categorychecklist li').each(function () { var $this = $(this); if ($this.children('.children').length) { $this.children('label').css('font-weight', 'bold'); } }); // Collapsible subcategories $('.categorychecklist li').each(function () { if ($(this).children('.children').length) { $(this) .children('.children') .hide(); $(this) .children('label') .before( '[+]' ); } }); $('.categorychecklist').on('click', 'a.toggle-subcategories', function (e) { e.preventDefault(); e.stopPropagation(); var $this = $(this); $this.parent() .children('.children') .slideToggle('fast', function () { $this.toggle(); $this.siblings('.toggle-subcategories').toggle(); }); }); // Auto-select parent categories when child is selected $('.categorychecklist').on('change', ':checkbox', function () { var $this = $(this); if ($this.is(':checked')) { // Check all parent categories $this.parents('li').children('input:checkbox').prop('checked', true); } else { // Uncheck child categories if parent is unchecked $this.closest('li').find('input:checkbox').prop('checked', false); } }); // Prevent default category from selecting unrelated categories $('.categorychecklist input[type="checkbox"]').on('change', function () { const defaultCategoryId = 1; // Replace with the ID of your default category (General Knowledge Mcqs) if ($(this).val() == defaultCategoryId) { if ($(this).is(':checked')) { // Uncheck all other categories $('.categorychecklist input[type="checkbox"]') .not(this) .prop('checked', false); // Clear 'Make Primary' for unrelated categories $('.categorychecklist li').each(function () { if ( $(this).find('input[type="checkbox"]').prop('checked') === false ) { $(this).find('.cat-item-action').remove(); } }); } } }); // Update 'Make Primary' visibility based on checked categories $('.categorychecklist input[type="checkbox"]').on('change', function () { const $parentLi = $(this).closest('li'); const isChecked = $(this).prop('checked'); if (isChecked) { $parentLi.find('.cat-item-action').show(); } else { $parentLi.find('.cat-item-action').remove(); } }); })(jQuery); Comments on: Which PSL franchise has announced to not include players in the next edition,those who do not come to play scheduled matches of PSL in Pakistan? https://pakmcqs.com/pakistan-current-affairs-mcqs/which-psl-franchise-has-announced-to-not-include-players-in-the-next-editionthose-who-do-not-come-to-play-scheduled-matches-of-psl-in-pakistan Pakistan's largest Mcqs website Mon, 09 Apr 2018 13:55:56 +0000 hourly 1 https://wordpress.org/?v=6.7.1