In a tic tac toe game, when a game is won, I want the wiing line's background to go red.
I have taken the wiing line box id's into an array as such-
if (cell1.ierText == symbol && cell2.ierText == symbol) {
if (cell3.ierText == symbol) {
wiingLine=[cell1.id,cell2.id,cell3.id]; //contains the id's of wiing line
winFlag = true;
}
Then I add the css when a win is confirmed using this function-
function addOrRemoveCSS(line){
var i=0;
while(i<3){
var cell=$(line[i]); // This is my main doubt. Can I do this??
cell.toggleClass("wiingCSS");
i++;
}
}
Is there something wrong that Im doing here?? Because there is no change in the background.
