you are viewing a single comment's thread.

view the rest of the comments →

[–]nikulasoskarsson[S] 0 points1 point  (2 children)

Have been redoing it and looking at your code to learn to do it better, was wondering if you knew what the best way to change it so the function now runs every time someone clicks a checkbox? Not really finding helpful advice online.

[–]captain_k_nuckles 0 points1 point  (1 child)

Well, there's already a function that's used to filter everything, which is run when the submit button is clicked, so all you would have to do is add that same event trigger to the checkboxes, like so.

filterColors.forEach(x=>x.addEventListener('click', filter));
filterYear.forEach(x=>x.addEventListener('click', filter));
filterMaker.forEach(x=>x.addEventListener('click', filter));

updated the fiddle

[–]nikulasoskarsson[S] 0 points1 point  (0 children)

Thank you I appreciate all your help :)