jquery dom reade evivalent в чистом JavaScript
docReady(function() {
// DOM is loaded and ready for manipulation here
});
code fighter
docReady(function() {
// DOM is loaded and ready for manipulation here
});
function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete" || document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}