+ 1

Why does this give me error?ā¬‡ļø

I want the circle that you touch to change color. https://code.sololearn.com/W3X3g8VHjncr/?ref=app

27th Mar 2022, 1:02 PM
Spencer Pawlik
Spencer Pawlik - avatar
10 Answers
+ 1
Lego in Motion Write color codes inside single or double quotes because that are String.
27th Mar 2022, 1:11 PM
AĶ¢J
AĶ¢J - avatar
+ 1
You mean instead of backgroundColor = #600 it should be backgroundColor = "#600" ? Cause that doesn't work.
27th Mar 2022, 1:14 PM
Spencer Pawlik
Spencer Pawlik - avatar
+ 1
Put value in quotes.. "#600" window.onload is not working.. Idk? Use script in html, then it's working fine
27th Mar 2022, 1:14 PM
Jayakrishna šŸ‡®šŸ‡³
+ 1
1. Color name must be between quotation mark "#000" , "#0af" ...etc 2. Tty to write all JavaScript code inside window.onload function window.onload=()=>{ //Your Code goes Here }
27th Mar 2022, 1:16 PM
Pariket Thakur
Pariket Thakur - avatar
0
Lego in Motion If you are calling function from html elements then don't make functions inside window.onload function because when you will click on button then functions will be call. Also you have to write color inside single quotes
27th Mar 2022, 1:09 PM
AĶ¢J
AĶ¢J - avatar
0
Thanks but I changed that but it still isn't working (that still probably changed something though). If you click on one of the circles it will give an error saying wack1 is not defined.
27th Mar 2022, 1:12 PM
Spencer Pawlik
Spencer Pawlik - avatar
0
I'll check...
27th Mar 2022, 1:13 PM
Spencer Pawlik
Spencer Pawlik - avatar
0
FF9900 thank you very much. But I don't understand the code so I won't use it. But really thank you for doing that!
27th Mar 2022, 1:18 PM
Spencer Pawlik
Spencer Pawlik - avatar