4,554
edits
No edit summary |
No edit summary |
||
Line 584: | Line 584: | ||
function logCardsWithTypeAndSubject(typeValue, subjectValue) { | function logCardsWithTypeAndSubject(typeValue, subjectValue) { | ||
$('.card').each(function() { | $('.card').each(function() { | ||
var typeText = $(this).find('.type').text().trim(); | // Extract the text within the anchor tag under the .type div | ||
var typeText = $(this).find('.type a').text().trim(); | |||
// Extract the text of the .subject div, which could have multiple values | |||
var subjectText = $(this).find('.subject').text().trim(); | var subjectText = $(this).find('.subject').text().trim(); | ||
if (typeText === typeValue && subjectText | // 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 the conditions are met, log the card's title or any other required details | |||
var titleText = $(this).find('.title').text().trim(); | var titleText = $(this).find('.title').text().trim(); | ||
console.log('Card with type "Book" and subject "Activism": ' + titleText); | console.log('Card with type "Book" and subject "Activism": ' + titleText); | ||
Line 597: | Line 601: | ||
// Call the function to log cards with the type "Book" and subject "Activism" | // Call the function to log cards with the type "Book" and subject "Activism" | ||
logCardsWithTypeAndSubject('Book', 'Activism'); | logCardsWithTypeAndSubject('Book', 'Activism'); | ||
}); | }); |