4,090
edits
No edit summary |
No edit summary |
||
Line 585: | Line 585: | ||
// Initially hide all cards | // Initially hide all cards | ||
$('div.filtered-list-item .card').hide(); | $('div.filtered-list-item .card').hide(); | ||
$('.card').each(function() { | $('.card').each(function() { | ||
var typeText = $(this).find('.type a').text().trim(); | var typeText = $(this).find('.type a').text().trim(); | ||
var subjectText = $(this).find('.subject').text().trim(); | var subjectText = $(this).find('.subject').text().trim(); | ||
// Check if the card's type matches 'Book' and if the subject includes 'Activism' | // Check if the card's type matches 'Book' and if the subject includes 'Activism' | ||
if (typeText === typeValue && subjectText.split(',').map(function(s) { return s.trim(); }).includes(subjectValue)) { | if (typeText === typeValue && subjectText.split(',').map(function(s) { return s.trim(); }).includes(subjectValue)) { | ||
// Show this card and its parent | |||
// | $(this).show().closest('div.filtered-list-item').show(); | ||
$(this).closest('div.filtered-list-item').show(); | |||
} | } | ||
}); | }); | ||
Line 605: | Line 600: | ||
// Call the function to filter and display only cards with the type "Book" and subject "Activism" | // Call the function to filter and display only cards with the type "Book" and subject "Activism" | ||
filterCardsToShowOnlyTypeAndSubject('Book', 'Activism'); | filterCardsToShowOnlyTypeAndSubject('Book', 'Activism'); | ||
}); | }); |