Is it possible to hold or delay document.ready execution for sometime?

Technology CommunityCategory: jQueryIs it possible to hold or delay document.ready execution for sometime?
VietMX Staff asked 3 years ago

Yes, its possible. With Release of jQuery 1.6, a new method “jQuery.holdReady(hold)” was introduced. This method allows to delay the execution of document.ready() event. document.ready() event is called as soon as your DOM is ready but sometimes there is a situation when you want to load additional JavaScript or some plugins which you have referenced.

$.holdReady(true);
$.getScript("myplugin.js", function() {
     $.holdReady(false);
});