Design comparison
SolutionDesign
Solution retrospective
This is my frist challange in Frontend mentor.
Community feedback
- @unachozaPosted about 1 year ago
Hi Suraj,
I looked at your code, although the functionality is achieved, you have 5 functions that are essentially the same. You can make this much DRY-er by writing a function with event target as the variable! Try adding just one event listening on all your mark
<span>
s*function: *
const selectRating = (e) => { styleSelector(); let mark = e.target.id let markValue = e.target.innerHTML mark.classList.add("rateSelect") rate.innerHTML = `you selected ${markValue} out of 5`; }
add eventlistener to all marks:
allMarks.addEventListener("click", selectRating(e))
hope this helps!
Marked as helpful1 - @oficial51Posted about 1 year ago
I would advise you to make it responsive😅. However nice job!
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