Submitted almost 2 years ago
Interactive rating component using custom radio buttons
@matthew-millard
Design comparison
SolutionDesign
Solution retrospective
-
Was using custom radio buttons the correct approach for creating the interactive rating feature? If there are more efficient ways, what are they?
-
The BEM naming convention is completely new to me, am I applying it correctly?
-
Is there a more efficient way to replace the content in the rating card once the score has been submitted?
const scores = document.getElementsByName('rating')
const thankYouStatement = document.getElementById('#thank-you-statement')
scores.forEach(score => {
if (score.checked) {
document.querySelector('.component__content').innerHTML = thankYouStatement
const message = `You selected ${score.value} out of 5`
document.querySelector('.thank-you-message').innerHTML = message
document.getElementById('thank-you-statement').style.display = 'initial'
}
})
}
Community feedback
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