Fazza Razaq Amiarso• 2,340
@fazzaamiarso
Posted
Hi, Great work!
to persist the style when selected, you can add an active class to the button when clicked.
selectedBtn.forEach(i => {
i.onclick = () => {
//remove all the active class from all buttons
selectedBtn.forEach(button => button.classList.remove("active"));
//add active class to selected
i.classList.add("active");
userRating.innerHTML = `You selected ${i.value} out of 5`
submit.disabled = false
}
})
I hope it helps! Cheers!
0