Uncaught ReferenceError: loadCarPage is not defined onclick http://127.0.0.1:5500/index.html:1

Can anyone help me with debugging the above error message? while creating a 3d car portfolio website on my laptop. #front-end
5 Replies
Wolle
Wolle15mo ago
If using modules (type="module") variables and functions do not get put on the window object. If you have a normal <script> and put function test(){..} there, you can call it via window.test(), because it is put there. That does not happen in modules, you have to do this explicitly, for example:
window.loadCarPage = ()=>{..}
//or
function loadCarPage() {..}
window.loadCarPage = loadCarPage
window.loadCarPage = ()=>{..}
//or
function loadCarPage() {..}
window.loadCarPage = loadCarPage
supamars7
supamars715mo ago
Many thanks, let me try it now
supamars7
supamars715mo ago
i omitted scene.bin because it's 63MB but it's yet to really display on my browser. please, check the rest files if am doing the right thing
supamars7
supamars715mo ago
Karol Miklas
Sketchfab
(FREE) 1972 Datsun 240k GT - Download Free 3D model by Karol Miklas...
1972 Datsun 240k GT Modelled in Blender in 2012, renewed in 2017 to match current Sketchfab viewer Textures and materials might need to be applied manually. - (FREE) 1972 Datsun 240k GT - Download Free 3D model by Karol Miklas (@karolmiklas)
supamars7
supamars715mo ago
i appreciate your answer but kindly check my uploaded files if you can help me debug it
Want results from more Discord servers?
Add your server