Closed plusflora closed 9 months ago
If you console.log tileEls
and tile
within this if statement:
if(check(curBoardState, winCon) === true){
console.log('confirming the curBoardState and winCon match inside checkWin')
cellEls.forEach((cell) => {
cell.classList.add('win')
})
}
what do you get?
Also in your css, you'll want to give margin-bottom: ;
a value
When setup like this - I get the tiles to change to green.
if(check(curBoardState, winCon) === true){
console.log('confirming the curBoardState and winCon match inside checkWin')
cellEls.forEach((cell) => {
cell.classList.add('win')
})
console.log(tileEls)
console.log(tile)
}
but the console kicks this.
if the console.log(tile)
is not there, the green does not appear.
and I removed the margin-bottom
shortly after submitting this ticket.
On further inspection, it only works if there's an Uncaught Reference Error. What is in the console.log()
does not matter, as long as it returns an error, the tiles shift to green as expected.
And while I was waiting, I went through and cleaned up some code. It works as intended now. I don't know what I did.
What's the problem you're trying to solve?
I'm trying to get my tiles to update their class to change the background color upon hitting the checkWin = true state. I've added a .win class to the bottom of the style sheet but still nothing.
Post any code you think might be relevant (one fenced block per file)
in my css
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
Tiles aren't changing color upon hitting the win state. the console log pops out so I assume I've set the win correctly.![image](https://github.com/sei-ec-remote/project-1-issues/assets/150221106/73733b34-2c05-4c6e-aa97-a9f57cac0323)
What is your best guess as to the source of the problem?
Probably something in how I ended up getting the tiles setup.
What things have you already tried to solve the problem?
I've tried assigning it to the tile elements as well as the class elements. I've also checked how others have done this and it seems similar.
Paste a link to your repository here
https://github.com/plusflora/Project-1