0

Why is the output null instead of the div element?

Something seems be wrong with my sololearn editor. Any reference I make to an HTML element in JavaScript outputs null. I don't know why. I'm not able to upload any of my recent codes because of this. Please help. https://code.sololearn.com/WgC6NwEWg4J1/?ref=app

13th Jan 2022, 2:46 PM
Logos
Logos - avatar
2 ответов
+ 1
Recently, I also had some problems with a JS code on my SL Playground. The code is saved as code bits. When I try some loops, the Playground blocks. I need to restart SL mobile app. I tried this code in your file and there is an error, so there are some problems: var demo = document.getElementById("demo"); demo.innerHTML = "test"; //console.log(demo);
13th Jan 2022, 3:00 PM
Romeo Cojocaru
Romeo Cojocaru - avatar
+ 1
window.onload = ()=>{ const demo = document.querySelector('#demo') console.log(demo) }
13th Jan 2022, 3:18 PM
Avinesh
Avinesh - avatar