0
WEB: Please help me finalize this code (Uncaught Type Error)
I'm finalizing my image editor Code. It says "Uncought TypeError: Cannot read.....line 446. I tried everything I could, _ no good result. Can u help me fix this problem, @ line 446, : It's supposed to make the help button's content display. ---- Also, The Hardware (CSS: line 55 ) On my phone the margin fits perfectly under the Image. But on other Devices, It Is further down away from the Image. I need help with that too, but I want to focus on the JS first. https://code.sololearn.com/Wep8Iw2ZgCiF/?ref=app
6 odpowiedzi
+ 1
Ginfio
Uncaught TypeError: Cannot read property 'addEventListener' of null
Line: 446.
The cause of this error is due to line 445 trying to access the document before the document is loaded.
The simple fix is to move the closing bracket of the anonymous function(window.onload) to encompass the other lines of code that need to access the Document.
https://code.sololearn.com/WF5IHh54qEQS/#js
btw- If you don't mind asking, what device were you using when you saw the error message?
+ 2
Shadow Can u please check it now, and see if that error is still there?
Thanks
+ 1
I can only help you with the JS, but luckily, that is rather simple. You ended your onload() function on line 443, so the variables that come afterwards that retrieve elements from the document are null since the page hasn't finished loading at initialization time. You should include everything except the very first and very last function in the onload() function, that will make it work.
+ 1
ODLNT , i looked at it on DELL desktop.
i made the code on my phone, so i didnt get any errors, but on the desktop i did.