Design comparison
Solution retrospective
I have a problem when I click on any of the buttons it duplicates the cards and I couldn't fix it. Any feedback would be amazing 😅
Community feedback
- @winninggodspowerPosted over 2 years ago
I con see you are printing the whole cards again to the frontend instead of just changing the previous value. if you want to go ahead with this approach. then your should clear the previous cards first using
let cards = document.getElementsByClassName('card')
cards.forEach(element => {element.remove})
1@xsaulPosted over 2 years ago@winninggodspower Well, I thought easier just print the cards again and just use display none to hide the other ones 😅. But well talking about what you advised me, I need to put:
cards.forEach(element => {element.remove})
in every function that is loading the data, right?
0@winninggodspowerPosted over 2 years ago@xsaul I meant you'll have to run that function before loading the new data.
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