I have this script I made, but I need help to complete it. I want to show a message if isotope filters return no results.
So far, the script works if I use one function at a time (one function is for input field and one function is for select fields), but I need to combine functions so if I use input or select (or both) it will work.
My select function is commented out because, like I said, they don't work together so far.
Here's my code so far:
let selectChange = $('#filters select');
let inputChange = $('#filters input');
let noResults = $('.no-results');
let reset = $('#isotope-reset');
selectChange.change(function() {
if($('.container.isotope').children(':visible').length == 0) {
//noResults.show();
}else {
//noResults.hide();
}
});
inputChange.on('input', function() {
if($('.container.isotope').children(':visible').length == 0) {
noResults.show();
}else {
noResults.hide();
}
});
reset.on('click', function() {
noResults.hide();
});
Any help would be appreciated. Thanks!