dom ready js

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

Also in JavaScript: