Похожие чаты

I have done some DOM manipulation in javascript file and

entire file code is wrapped inside
window.onload = function() {
// all code

}
Now I am appending child to div so when this file is executed I get typeerror cannot read property appendChild of null querySelector of null in browser console. How to avoid such issues?

12 ответов

36 просмотров

some messages ago Simen said Try document.addEventListener("DOMContentLoaded", ...) instead of window.onload

Adi- Автор вопроса
Adi- Автор вопроса
Adi- Автор вопроса
bitwise
show codes

giving error https://pastebin.com/0X6KNHf5 at line 15 and 31

Adi- Автор вопроса
Adi
also line 61

error in fakeMessage or insertMessssage ?

Adi
also line 61

http://jsfiddle.net/jvillars/BZsvh/

Adi- Автор вопроса
bitwise
error in fakeMessage or insertMessssage ?

no nothing like that only getting typeError

Adi- Автор вопроса
bitwise
http://jsfiddle.net/jvillars/BZsvh/

So you are suggesting I should use document.getElementById().appendChild() instead of msgContainer.appendChild(domNode); ??

Adi
screenshot no nothing like that only getting typeError

When debugging, always start with the first error. Sometimes it's the only one you need to fix.

Adi
So you are suggesting I should use document.getEle...

I am suggesting put your script on top of the page wrapped in function and invoke at bottom of the pagge

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта