check if the document is ready using Vanilla JavaScript code example
Example: js vanilla dom ready
document.addEventListener("DOMContentLoaded", function() {
// code
});
document.addEventListener("DOMContentLoaded", function() {
// code
});