I try to create simple filtering with JS but I have problem with multiple select fields, they are not cooperate together, and results going crazy (sometimes nothing shows). Everything is good if I use only one select, when I try to add second one, or third one results are not correct or I got blank page.
Here is my code: https://jsfiddle.net/au6jbsL5/
And here is my filter function (I have 3 functions - one for each select group)
$('select#sort-cost').change(function() {
var filter = $(this).val()
filterList(filter);
});
function filterList(value) {
var list = $(.news-list .news-item);
$(list).fadeOut(fast);
if (value == All) {
$(.news-list).find(article).each(function (i) {
$(this).delay(100).slideDown(fast);
});
} else {
$(.news-list).find(article[data-category*= + value + ]).each(function (i) {
$(this).delay(100).slideDown(fast);
});
}
}