0
I’m trying to make an old game. So far I managed to make the appointments change every turn and the function to delete the appointments.
ps: I’m using black and red color instead of ball and "x".
My problem is that the markings change even after they are marked if you click on it again. I want once clicked the elements keep their markings (bgcolor)
.
http://jsfiddle.net/11nokxho/1
For this I tried to solve by putting the first if checking if the background does not have white initial color, if it does not have false return and stop the function.
if(!casa.style.backgroundColor == "#FFF") return false;
Since it doesn’t work.
About the operator: ! home.style.backgroundColor == "rgb(255, 255, 255)". Of course it is, isn’t it? I’m confused. At last
– ropbla9
I do not understand why it worked to change color even in HEX and did not work for the first test?
– ropbla9
I can’t remember if I marked you.
– ropbla9
@ropbla9 Using the
!
in front of the expression indicates that you want to do the inversion of the result, but only works with boleanos, in case,casa.style.backgroundColor
returns a string, to work as expected, you have to enclose with parentheses like this:!(casa.style.backgroundColor == "rgb(255, 255, 255)")
soon find easier to use!=
directly...– Jader A. Wagner
and on the second comment?
– ropbla9