@AdrianoEscarabote
Posted
Hello Sérgio Faria, how are you? I truly loved your project's outcome, however I have some advice that I hope you'll find useful:
To make the submit button work only when the user selects a number we can do this:
const selected = (e) => {
number = e.target.getAttribute('data-value');
console.log(number);
e.target.classList.add('active');
for (let i = 0; i < selection.length; i++) {
if (selection[i].getAttribute("data-value") !== number) {
selection[i].classList.remove("active");
}
}
note.innerHTML = ` <div class="selection--text"> You selected ${number} out of 5</div> `;
button.addEventListener('click', () => {
contRate.style.display = 'none';
contResult.style.display = 'block';
});
}
The remainder is excellent.
I hope it's useful. 👍