Compile Error | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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

11th Apr 2024, 7:48 AM
Colton Minard
3 Respuestas
+ 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 }
11th Apr 2024, 9:04 AM
Lisa
Lisa - avatar
+ 3
it depends on the browser and the location of the script in the html
11th Apr 2024, 3:52 PM
Lisa
Lisa - avatar
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?
11th Apr 2024, 3:01 PM
Colton Minard