Submitted
This project was important to put my first knowledge of JavaScript in practice. I tried first to get the number rating using the URL info, but I remembered that I could get what HTML is checked and get it value, so it was easier for me using this method.
<input type="radio" name="rating" id="one" value="1">
<label for="one">1</label>
I tried to use a forEach loop to search the checked radio but it's performance it wasn't good because it search for every single radio of my form even it wasn't checked, so I change to a for loop that stop the loop with a break when found a radio checked.
for (let i = 0; i < radios.length; i++) {
if(radios[i].checked) {
const value = radios[i].value
rateNote.innerText = `You selected ${value} out of 5`;
break
}
}
My first approach to change the images was using JavaScript to change the source, but it had a ugly transition even I set a transition in CSS, perhaps I screwed the accessibility with this.