+ 1
Whatâs wrong with my code
Iâm trying to use the ToggleClass method with Jquery. I wanted to be able to change the background color of the div cont (container), and also to do a night mode button. However the nigh mode button doesnât change the background color of the cont div. And the cont div doesnât change color either with the second button. Do you see whatâs wrong in the code itself ? https://code.sololearn.com/Wz0vnn4687rp/?ref=app
3 Answers
+ 1
The problem is that rule by id selector have more importance than by class... Try to add !important in background-color of your .nit class
+ 1
whouah ! It works great. Thank you very much KrOW, I didnât have any clue about !important
0
Take note that its NOT suggested use important except rare cases.... Read here for futher info https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity