document ready javascript vanilla

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

Also in JavaScript: