britnay268 / INDIVIDUAL-ASSESSMENT-vocab-YOU-lary

1 stars 0 forks source link

Make Filter Buttons work #11

Closed britnay268 closed 8 months ago

britnay268 commented 8 months ago

Will need to create an eventListener to listen for clicks on buttons.:

Potential code for filterButtons


const filterBtns = document.querySelector("#filterBtnsConatiner");
  filterBtns.addEventListener("click", (e) => {
    // console.log(e.target.id)
    if (e.target.id === "all") {
      studentsOnDom(data);
    } else if (e.target.id) {
      const card = data.filter((c) => c.house.toLowerCase() === e.target.id);
      studentsOnDom(card);
    }
  });
britnay268 commented 8 months ago

My potential code mentioned above is far from what I actually did.