0
I copied the JS in this code from W3 schols. Why am I getting an error?
https://code.sololearn.com/WErF2c5rH78h/#html Getting an error on line 6. Why?
3 Respuestas
+ 2
Because you cannot access to an element DOM with js if its not loaded... You have to make sure that any access to DOM happen after its loaded (at example in window.onload listener)... in your case remove the function call w3CodeColor and add it in
window.onload= function(){
// add here
}
0
https://www.w3schools.com/howto/howto_syntax_highlight.asp
This is where I got the code from.