addevent listener ready code example
Example: javascript wait for document load
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});