New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Hey Why Does my javascript Always return the Uncaught type error when everything is fine
4 Answers
+ 4
You have to use window.onload before your "main" js code.
window.onload = function() {
//code
}
+ 2
Well Maybe In desktop I could add defer In my tag how can i stop this in This app
0
Because your JS code is running before the HTML body has loaded.
0
use onload attribute to body and function around code.
<body onload="init();">
function init() {
// js code
}