I created a switch,I want if it is clicked the smaller circle moves 50px left and cylinder will change the background color | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

29th Apr 2019, 6:04 AM
SCP 251
SCP 251 - avatar
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
29th Apr 2019, 6:42 AM
Taste
Taste - avatar
0
Also because x is getElementById So no need to x[0] Just x. x.style.left =..
29th Apr 2019, 1:20 PM
Gordon
Gordon - avatar