0
Good morning sir. I want to toggle more one color. I try blue again to toggle tree color. Thanks you sir.
toggle tree color. https://code.sololearn.com/Wz2zd7JqqMn8/?ref=app
2 Réponses
0
Toggle is like on off so at a time you can apply only one color. You cannot apply more.
0
This JavaScript code do the trick
let i = 0
function addColor (){
    let el = document.querySelector (".yellow");
    let colors = ["red", "blue", "yellow"]
    
    if (i == colors.length) {
      i = 0
      for (let color of colors) {
        el.style.color = color
      }
    }
  el.style.color = colors[i]
  i++
}



