javascript on document ready
document.addEventListener("DOMContentLoaded", function(){
// Handler when the DOM is fully loaded
});
Julian Motz takes a look at jQuery's document.ready() method and shows how it can be replaced with vanilla JS, and is often not needed at all!
Here is what the above code is doing:
1. When the document is fully loaded, the ".addEventListener()" method is called which has the string ""DOMContentLoaded"" as the event parameter.
2. When the event occurs, the function ""function(){}"" is called.
\