+ 4
Can someone tell me how I create a functional button that when I click on it changes the background color?
3 Answers
+ 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! đ
+ 5
Johan Alejandro Arena Tick mark that answer if it helped you đ
+ 2
Thanks so much