document.addEventListener("DOMContentLoaded", function() { // code });

js vanilla dom ready