Похожие чаты

When we need DOMContentLoaded?

6 ответов

4 просмотра

say your page takes time to load and you need to add event handlers through the addEventListener for each element, waiting for the load event might take time making all those displayed buttons unresponsive, so DOMContentLoaded just tells you all the html from the server has been parsed

Mr-Thieves Автор вопроса
Mr Thieves
so if i want add elements with js should i use tha...

it is fired before script files and css files are actually parsed, just that html is now ready. inline script will work though

Mr Thieves
so if i want add elements with js should i use tha...

ok, answering your question, yes you can add elements

Mr-Thieves Автор вопроса
Richard | Dm for Paid Support
ok, answering your question, yes you can add eleme...

no i am asking if i want add elements and modify DOMs should i use DOMContentLoaded or not?

Mr Thieves
no i am asking if i want add elements and modify D...

Take it this way, inline scripts will work for everything before their tag, DOMContentLoaded just tells you the whole doc has been parsed following the few exceptions outlined in the official documentation

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

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

я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
49
30 BCH videos in Hausa Language successfully delivered. In December 2023, I created a Flipstarter to produce Bitcoin Cash videos in the Hausa language for greater outreach an...
Munnir
5
читать файл максимально быстро? странный вопрос))
zamtmn
53
Интересно, а майкрософт 365 может запустится на линукс минт?
Лисицка
17
How to create an OS in C? what to study?
Linus
18
Компания Elif ищет менеджера проектов, который будет заниматься поиском и ведением новых проектов. Прежде чем приступить к работе, вам нужно пройти наш недельный курс, где вы ...
Elif
5
братва! где куличи брать?
Alöscha
25
Привет, кто может сделать юзербота с апи? Задачи: - создавать группы - создавать каналы - задавать для созданных каналов аватарку или эмоджи, имя группы - добавлять в группы...
Lencore
11
на сколько можно увеличить swap при 16Гб оперативы?
Хасан Ахмаев
11
тоесть, указав return eax, сгенерируется никому ненужная инструкция mov eax,eax ?
Aiwan \ (•◡•) / _bot
24
Карта сайта