Can you suggest an alternate way to get rating from the buttons? Feedback is appreciated!
Gürkan Özer
@gurkanozerAll comments
- @alirmemon37Submitted over 2 years ago@gurkanozerPosted over 2 years ago
Hi @alirmemon37 , good job. Your solution looks good and work well.
My suggestion is you can use radio buttons instead of buttons. I think it's better way to do.
And you can give rates as value.
rating = Number(btn.textContent);
instead of this you can simply userating = btn.value;
Happy coding.
Marked as helpful0 - @Duyen-codesSubmitted over 2 years ago
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!
@gurkanozerPosted over 2 years agoHi, 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 - @jdpaigeSubmitted over 2 years ago
It took me far too long to realize I could just put a div inside of a label for a radio input, in order to center the numbers and still have both the text number and circle the toggle for the radio inputs...
I wanted to keep the card height and style consistent, so rather than make an entirely new card on click, I just used JS to toggle a 'hidden' class on whatever I wanted to show inside the card. I am aware that if this were a bigger project, this kind of thing would be better handled by React but I think this works fine too.
All in all, this took me longer than I thought but I learned a lot along the way!
3/20/22 Update - made changes based on feedback. Hopefully this fixed issues.
@gurkanozerPosted over 2 years agoHi, Jaron. Nice work. But you re using divs for everything. its not good a practice.
- Don't use divs as button or any interactive elements if u want make your button/element accessible.
- And use span in label (rating-container), not div. if you check your html issues you can see its not allowed.
0 - @titocsSubmitted almost 3 years ago
i dont know why the Trash Button cannot be targeted by event.target so it cannot be clicked? also, feedback are open :) Thanks