#Urgent JavaScript Help Needed - Filterable Gallery

3 messages · Page 1 of 1 (latest)

trim egret
#

Hello, I have an assignment on a deadline that basically consists of making a page that is a gallery, and it needs to be filterable among other things. I can't get that filterable part to work for the life of it, and I am in dire need of help.

#
let list = document.querySelectorAll('.checkbox');

for(let i = 0; i < list.length; i++){
    list[i].addEventListener('change', function(){
        currFilters.push(list[i].getAttribute('data-filter'));
        activeFilter();
        console.log('filter');
    })
}

async function activeFilter()
{
    let lastPerson = data.length;
    console.log(lastPerson);
    for(let person = 0; person < lastPerson; person++)
    {
        if(currFilters.includes(data[person].author))
        {
            refreshGallery();
            authorDisplay(person);
            makeList(person);
        }
    }
}
#

This is the function I am trying to make, however even if I make it output anything to the console to check if it works, nothing happens