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

28th Jan 2022, 8:05 AM
Malick Diagne
Malick Diagne - avatar
2 Réponses
0
Toggle is like on off so at a time you can apply only one color. You cannot apply more.
28th Jan 2022, 8:48 AM
A͢J
A͢J - avatar
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++ }
29th Jan 2022, 3:56 AM
Samuel Adepoju
Samuel Adepoju - avatar