0
A little help! Why is this an error?
var g = document.getElementById("box1"); function func() { g.style.background = "#FF00FF18"; } func();
11 Answers
+ 4
You had some capitalised letter discrepancies.
Check out my version of your code.
https://code.sololearn.com/Wg01AIKYUVz3/?ref=app
+ 4
Please LINK YOUR CODE so we can test it. What error do you get?
+ 4
wrap your code inside an onload function
window.onload = ()=>{
//your code
}
+ 2
AUSGRINDTUBE yeah your version does work but I still don't understand why mine doesn't đ€
+ 2
Percy Thethe
check your first js line in js
var g = document.getElementById("box1")
//supposed to be like this
var g = document.getElementById("Box1")
+ 2
sendy kooper what isn't possible on your PC? If you don't have the same problem, can you please start your own thread/post/question?
+ 1
https://code.sololearn.com/W1P6LF4bdCsc/?ref=app
Here's the Code.
+ 1
MATOVU I tried that it didn't seem to work đ€Šđœââïž
+ 1
the error is at this line
var g = document.getElementById("box1")
Box1 is the id you used