@elyyyse
Posted
Hey, Nawal - Nice work! I made a pull request here, so you can see the few lines I added to grab the rating value and present it on the next card.
Basically, I selected the <div class="rating">
on the Thank You card and named it confMsg
. Then in your change()
function, I assigned the value of selectedDiv
to a variable and updated the confMsg
with that. This solution breaks some of your styling, but hopefully it gets the point across.
Next time, consider using <label>
tags instead of <div>
s for your <input>
s. That way, even when you hide the default styling with display: none;
, the <input>
itself still gets selected when a user clicks on the styled <label>
. Then you can take advantage of native functionality and use something like document.querySelector('input[type="checkbox"]:checked')
to get the value. (I would also recommend radio buttons over checkboxes for this particular use case.)
I hope this makes sense. Feel free to reply back with questions!