Change code to filter via multiple attributes
I have a filter setup using jQuery as per the snippet.
I would like to be able to filter by multiple attributes - at the moment I can only filter by the title attribute.
How would I change the code so that I can filter all 3 attributes - e.g. title, data-emoji and version attributes?
$('[data-search]').on('keyup', function(e) {
var searchVal = $(this).val();
var filterItems = $('[title]');
console.log(filterItems);
if (searchVal != '') {
filterItems.addClass('hidden');
$('[title*="' + searchVal.toLowerCase() + '"]').removeClass('hidden');
} else {
filterItems.removeClass('hidden');
}
});
.hidden {
display: none;
}
π
π
π₯°
π
π
π€
π
π€