enter image description here

now I’m making webSite, but i have problem in js

what i make is card filtering

there are checkbox, each checkbox have id a, b, c, d

and also card have id too but card have multiple id, and random

if a checkbox checked then card with an ID of a is display, and b checkbox checked also b card is display

and here is my problem if i unchecked b checkbox, i want remain a cards but all card is gone

and next problem is if i checked reset checkbox, a cards are remain

// 각 체크박스의 상태를 추적하기 위한 객체
const checkboxStates = {};

seriesCheck.forEach((checkbox) => {
checkboxStates[checkbox.id] = false;

checkbox.addEventListener("change", () => {
  checkboxStates[checkbox.id] = checkbox.checked;

  cardSeries.forEach((card) => {
    const seriesCheckList = card.closest("li");
    let shouldBeVisible = false;
    seriesCheck.forEach((checkbox) => {
      if (
        checkboxStates[checkbox.id] &&
        card.textContent.includes(checkbox.id)
      ) {
        shouldBeVisible = true;
      }
    });

    seriesCheckList.style.display = shouldBeVisible ? "block" : "none";
  });
});

});

i think includes is the problem then how can i checked card filter?

New contributor

5647kr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.