+ 4

Can someone tell me how I create a functional button that when I click on it changes the background color?

20th Mar 2019, 5:14 AM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar
3 Respostas
+ 7
Check out this code I've just made: https://code.sololearn.com/Wq6EIToLHvtD/?ref=app Explanation: • I've given an Id "con" to body so that I can get its reference in JS. • Then I've made an input tag, whose type is button because you need a button. And on Clicking that, it will trigger a function "change()" defined in JS. • In the change() function, I'm just getting the reference of body tag and then changing its background color. As Simple as it sounds! 😉
20th Mar 2019, 5:22 AM
Letsintegreat
Letsintegreat - avatar
+ 5
Johan Alejandro Arena Tick mark that answer if it helped you 😊
20th Mar 2019, 7:08 AM
Letsintegreat
Letsintegreat - avatar
+ 2
Thanks so much
20th Mar 2019, 5:26 AM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar