$(document).wait() code example
Example 1: wait for the dom to load javascript
document.addEventListener('DOMContentLoaded', (event) => {
//the event occurred
})
Example 2: javascript document ready
$( document ).ready(function() {
console.log( "ready!" );
});
Example 3: jquery 1 second after page load
jQuery(document).ready(function() {
setTimeout(function() {
....
}, 2000);
});