+ 1
Why does this give me error?âŹď¸
I want the circle that you touch to change color. https://code.sololearn.com/W3X3g8VHjncr/?ref=app
10 Answers
+ 1
Lego in Motion
Write color codes inside single or double quotes because that are String.
+ 1
You mean instead of backgroundColor = #600 it should be backgroundColor = "#600" ? Cause that doesn't work.
+ 1
Put value in quotes..
"#600"
window.onload is not working.. Idk?
Use script in html, then it's working fine
+ 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
}
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
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.
0
I'll check...
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!