Design comparison
SolutionDesign
Solution retrospective
No way this is a newbie challange ... they should label it junior or higher ... i could'nt create the codes to check what number a user used ... can someone tell me how to do it .. thanks
Community feedback
- @Pawel-GnatPosted 12 months ago
Hey :)
You almost got it! You just have to store the value (use e.g. .textContent) while selecting the button. Then you should dynamically display the value on next page.
1@Pawel-GnatPosted 12 months ago@coding-stock Sure
const buttons = document.querySelectorAll('.button') const parentElement = document.querySelector('.container') let value = null parentElement.addEventListener('click', e => { if (e.target.classList.contains('button')) { value = e.target.textContent } })
and later you should pass that value inside your result page, after submitting.
example:
const resultText = `You selected ${value} out of 5`
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