@CarvalhoVincent
Posted
Hi, seems there's an error in your JS line 37, check the console with inspector. And duplicate id for "numbtn-5". The report show also : bad value put for attribute method on element form. Maybe it's a first step to resolve your problem. I'm not able to help you more this time, I did it with an array. Happy coding !
Marked as helpful
@tmoris
Posted
@CarvalhoVincent, Can you help me elaborate how I can handle it using the array method? Am new to JS, and am exploring new ideas. I believe that will be of help to learn. Thanks a lot, I appreciate.
@CarvalhoVincent
Posted
@tmoris I created 5 html buttons with value 1 to 5, and onclick that call a saveRate function.
const rating = ["0"];
function saveRate(el) {
rating.pop();
rating.push(el.value);
}
Then I call the array in the "thanks page"
function displayThanks() {
var thanksPage = document.getElementById("thanks");
if(rating > 0){
thanksPage.style.visibility = "visible";
document.getElementById("choice").innerHTML = rating;
} else {
alert("Please select a rating !");
}
}
Maybe it's not the best solution but it works for me. You can check https://github.com/CarvalhoVincent/rating-site Hope it is helpful !