[COMPLETED] The button is pressed the second time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[COMPLETED] The button is pressed the second time

Hi, I wanted to create a theme switch button for my site, but for it to switch the first time, you need to click twice, and then everything works fine from the first, what's the problem, how to fix button? Code: https://code.sololearn.com/Wf5haWLD4WR2/?ref=app

23rd Aug 2020, 12:06 PM
Desiigner_
Desiigner_ - avatar
3 Answers
+ 1
Michael, thank you for your help and participation
23rd Aug 2020, 12:15 PM
Desiigner_
Desiigner_ - avatar
0
You have to swap the call of brightTheme and darkTheme in your click function.
23rd Aug 2020, 12:09 PM
Michael
Michael - avatar
0
Bedrock Coder, thanks a lot 😄 I couldn't find the cause for three days, and it turns out it's so simple, thank you very much!
23rd Aug 2020, 12:15 PM
Desiigner_
Desiigner_ - avatar