doc on load code example
Example 1: dom ready js
document.addEventListener("DOMContentLoaded", function() {
// code
});
Example 2: call a function on load jquery
$(document).ready(function () {
// Function code here.
});
document.addEventListener("DOMContentLoaded", function() {
// code
});
$(document).ready(function () {
// Function code here.
});