Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Mobile First approach using TailwindCSS

#tailwind-css

@jchapar

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

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

Jon Wright 160

@Dr-Wrong-Mo

Posted

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 be Element.dataset.foo, which would return a value of 'bar'. Basically, it is any variable name you want after data-.

I hope this helps.

Marked as helpful

1

@jchapar

Posted

@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 GitHub
Discord logo

Join 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