diff --git a/assets/script.js b/assets/script.js index 6c975c3..2cca681 100644 --- a/assets/script.js +++ b/assets/script.js @@ -31,11 +31,14 @@ jQuery(document).ready(function ($) { } // Resource Types - selectedTypes.forEach(function (type) { + $('input[name="resource_type[]"]:checked').each(function () { + const slug = $(this).val(); // Get the slug + const name = $(this).closest('label').text().trim(); // Get the name + appliedFilters.push( - ` - Type: ${type} - + ` + Type: ${name} + ` ); }); @@ -104,7 +107,7 @@ jQuery(document).ready(function ($) { $('#search').val(''); } else if (filterType === 'resource_type') { $('input[name="resource_type[]"]:checked').each(function () { - if ($(this).closest('label').text().trim() === filterValue) { + if ($(this).val() === filterValue) { // Match the slug, not the name $(this).prop('checked', false); } });