help with resotoring the css pseudo class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help with resotoring the css pseudo class

Can anyone help with restoring the css pseudo class hover to the elements after refreshing the board? https://code.sololearn.com/W08lvBGjmGgX/#

30th Nov 2021, 4:06 PM
David
3 Answers
+ 1
Please always tag the language you're asking about. https://code.sololearn.com/W3uiji9X28C1/?ref=app
30th Nov 2021, 5:25 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Done
30th Nov 2021, 7:19 PM
David
+ 1
I was able to solve the problem. this line breaks the code: moves[number].style.backgroundColor = 'green'; this is the fix: moves[number].classList.add('colorWinner'); where the 'colorWinner' class is defined in the stylesheet as {background-color:green} apparently using the .style property disassociates the element from the style sheet. so if you need dynamic styling of elements make changes solely through the classList or solely through the .style property
3rd Dec 2021, 6:11 PM
David