+ 3
Why when I delete "if" it work's good but when I write it again the value of input is always black??
5 Réponses
+ 6
You need == for your if. Using single = assigns "black" every time. Also, all of the statements are missing semicolons.
+ 5
Sina The code works on my phone using both == and ===. It doesn't if y.value different in capital e.g. "Black", that doesn't work.
Try if(y.value.toLowerCase() === "black") this will compare the color value in lowercase, maybe it works : )
+ 2
See I want when the background color is black the style of "p" get's white
+ 1
When I use == it doesn't work. try it to see