Job listing with Vanilla JS, still stuck with filter functions
Design comparison
Solution retrospective
My filter function is not finished. I'll do more research and continue working on finishing the challenge later. I'm doing this with JS with no library or framework. I'd really appreciate if you could look at my codes and give me some lead of how to move forward with the functions. Any help/ feedback is greatly appreciated. Thanks!
Community feedback
- @gurkanozerPosted over 2 years ago
Hi, Duyen. I don't know if this help but this is how i did.
`let filterList = []
fetch(){ //get datas
//and create all cards
//visible cards has class named active so in this case i added active class to all cards.
//then select all tags in document.
const tags = document.querySelectorAll('.tag');
//and create event listener for each one.
tags.foreach(tag=>{
tag.addEventListener('click',()=>{
//add this tag to filterList.
//you need filter all cards by filterList. Then remove class active if card
//dont have this tag
});
//and re-render cards
}); `
Marked as helpful2@Duyen-codesPosted over 2 years ago@gurkanozer Hey! Thanks very much for sharing your solution approach. I'll try to implement that on mine. I think my solution now is unnecessarily complicated. Thanks again and keep up the great work!
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord