0
I need help finding the root of the problem. When I fix one error another one pops up like a chain reaction. What's the cause???
3 odpowiedzi
+ 4
Your javascript will run before the document is loaded, so all the `.getElementById` calls return null.
You need to wrap your entire code in one of these:
window.addEventListener("DOMContentLoaded", () => {
// code goes here
...
});
+ 3
Problem fixed !
https://code.sololearn.com/Wvo4BhpPESlF/?ref=app
Problem fix detail :
I putted your whole JS code inside
window.onload = function (){
//Your code
}
It make ur JS to run after the DOMs setup
Without it the JS code run before the DOMs setups in ur page and not able to get the wbtn id from Dom
So easy
+ 1
Thanks Schindlabua, Abhay. Curious thing is that the code works perfectly on another editor but SL had an issue with it, anyway I'm glad its a simple fix