+ 3
null - SoloLearn editor
Hi, I'm trying to enter the most recent contest - making the hacker terminal. The problem is SL editor keep throwing errors "cannot read property 'classList' of null. Why is this happening? It works on my PC via VSC it works on Jsfiddle and it works on codepen, exactly same code. I even tried babel but it gives the same results. Any ideas what's going on here? https://code.sololearn.com/W2lGIw8cLTKp/?ref=app It feels like JS is loaded before the DOM is generated...
4 odpowiedzi
+ 1
I solved it!
solo learn editor is loading JS first and then generating the DOM which is causing this errors. I just attached event listener to document ' DOMContentLoaded 'and wrapped whole code inside function.
+ 2
Hah sorry no, its working as expected now, please read my reply above :)