@Coltensiemer
Posted
Hello! The design is really good and works smoothly! To your question about how you could improve the javascript:
Adding an event listener works for each input works, however, that takes a lot more code and if you ever added more inputs, then you have to manually add another,
A better practice is to use a 'for' loop that goes over all the input inside a listener event.
for (let i = 0; i <input.length; i++){ //input is selected with 'queryselectorAll'
then an if statement
if (input[i].checked ) { rating.innerHTML = input[i].value } //rating is a getElementById }
This will allow any of the input buttons that are checked to change the innerHTML to the input value (value is labeled in html).
Try this method out if you want some extra learning.