can you make it so that when you click on the button its color changes, for example, to red, and when you press it again, it cha | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can you make it so that when you click on the button its color changes, for example, to red, and when you press it again, it cha

30th Aug 2018, 10:06 AM
Learner
8 Answers
+ 2
Just change "document.bgColor" to "style.backgroundColor" in the Code Satnam Singh provided for you.
30th Aug 2018, 1:08 PM
Janningā­
Janningā­ - avatar
+ 2
thank you
30th Aug 2018, 4:08 PM
Learner
+ 1
thanks
30th Aug 2018, 12:07 PM
Learner
+ 1
and you can make it so that the color changes the button?
30th Aug 2018, 12:09 PM
Learner
+ 1
thank you very much
30th Aug 2018, 1:32 PM
Learner
0
and you can make it so that when you press it again, the button becomes white
30th Aug 2018, 1:35 PM
Learner
0
How you implement the logic is up to you. You've completed the JavaScript tutorial, so you already have if/else and case/break in your arsenal. Happy to help troubleshoot any code you post in Code Playground and link here if you run into issues. Looking forward.
30th Aug 2018, 1:57 PM
Janningā­
Janningā­ - avatar