Design comparison
Solution retrospective
Any feedback is appreciated. JS functionality added to the submit button to change the content on the screen. Will be looking into having JS update the rating number selected and reflecting on the Thank you screen.
Community feedback
- @Dr-Wrong-MoPosted over 2 years ago
Hi Jose,
First, layout wise, your project looks nice.
Second, with the way you have your HTML setup using regular DIVs, I would recommend using data attributes.
You can set a data attribute on each voting div, something like:
<div data-value="1" class="... rating">
You can then access the data attribute in JS:
Element.dataset.value
If your
Element
is the defined as the above div, then this would return a value of 1, as declared in the HTML above.Just a note to be clear. The data attribute doesn't need to be "value". It could be
data-foo="bar"
and the JS would beElement.dataset.foo
, which would return a value of 'bar'. Basically, it is any variable name you want afterdata-
.I hope this helps.
Marked as helpful1@jchaparPosted over 2 years ago@Dr-Wrong-Mo Thanks Jon! I'll definitely look into refactoring my HTML when I return to continue working on the Js. Appreciate it!
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