javaScript ожидание загрузки документа
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});
Xenophobic Xenomorph
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});