+ 1
I created a switch,I want if it is clicked the smaller circle moves 50px left and cylinder will change the background color
Switch https://code.sololearn.com/Wx7EEXlUnSf8/?ref=app https://code.sololearn.com/Wx7EEXlUnSf8/?ref=app
2 Answers
+ 2
oh its because #div is covered by #div2
when you try to click on it, you actually click #div2. move #div on top of #div2 to make it work
0
Also because x is getElementById
So no need to x[0]
Just x.
x.style.left =..