javascript when page is ready code example
Example: js on page ready
document.addEventListener("DOMContentLoaded", function(event){
// your code here
});
Better than
window.onload = function(){
// code goes here
};
document.addEventListener("DOMContentLoaded", function(event){
// your code here
});
Better than
window.onload = function(){
// code goes here
};