+ 3
My code doesn't work on solo learn but works else where. Something i don't know about how this platform does its staff?
var myText = document.querrySelector("#text"); var myText = document.getElementById("text"); If i use one of the about, it shows some sort of error message Example: myText.style.color = "red"; I get this: Error: "Cannot read property 'style' of null"
4 Respostas
+ 3
The only error I cans see in the code you've posted here is that querrySelector should be querySelector, however it's difficult to fully understand your error without showing the full code. Could you post it in Code Playground and share it here?
+ 2
Thanks for your feedback guys, i got a solution.
window.onload worked just fine.
+ 2
I guess it had something to do with the script running before the being loaded by the DOM