0
Compile Error
When I run this, it is saying my .click function is set to null. I'm so lost, is it because sololearn does not recognize Math as a built-in function https://sololearn.com/compiler-playground/Wl235vnW0Iji/?ref=app
3 Answers
+ 4
Javascript can only fetch the html element once the body is fully loaded â not before that.
wrap all the js code in
window.onload = function(){
// here goes all js
}
+ 3
it depends on the browser and the location of the script in the html
0
Okay, but if I have an external file and put that src in the html, I will not have to do that. Is that correct?