+ 1
How to change between two color?
I want to change between two button text color everytime the button is pressed. But I can change color only 3 times. After that how many times I pressed the color was not changed. Whats wrong with my code? https://code.sololearn.com/Wfn1j0YfMdQ5/?ref=app
2 Réponses
+ 17
Change "/" to "%" in JS...
( var num = 0;
function show() {
var x = document.getElementById("btn");
if (num%2 == 0)
x.style.color ="yellow";
else
x.style.color ="green";
num++;
} )
+ 1
Thanks..:)