-3
I was able to change the color of the button at the beginning of the repetition, however I do not know how to return the original color to the end.
let interval = setInterval(function () {
if (i1 > 15) {
return clearInterval(interval)
}
document.getElementById(i1).style.backgroundColor = ' red '
if (notas1[i1] === 1) {
C_Teclado.play();
} else if (notas1[i1] === 2) {
CS_Teclado.play();
console.log("2");
} else if (notas1[i1] === 3) {
D_Teclado.play();
console.log("3");
} else {
SomVazio.play();
console.log("13");
}
i1++
}, 1000)
You can’t help yourself without knowing what you really want to do. Why do you need to go back to the original color? What variable is notes? What does it get? Does it have any specific value for it? If smaller than both it turns red, larger it both turns standard color?
– Azzi
Friend try to improve your questions, instead of putting your doubt in the title, try to detail well what you want to do and in the title put only the topic, for example: "Change button color" ai in the content of the question you detail more, the way you’re doing makes it hard to help you.
– Kayo Bruno