jQuery.holdReady() New in jQuery 1.6

With Release of jQuery 1.6, jQuery team has released a new method "jQuery.holdReady(hold)". 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. In such situation, You can make a call to this function to delay execution of document.ready() event.

This method must be called before document.ready() event. Calling this method after the ready event has already fired will have no effect.The best place to call is after you reference the jQuery.js in your script tag. When true is passed as argument, then it will delay the execution. When you want ready event to get executed then call "jQuery.holdReady(false)".

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

Note that multiple holds can be put on the ready event, one for each $.holdReady(true) call. The ready event will not actually fire until all holds have been released with a corresponding $.holdReady(false) and the normal document ready conditions are met.

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...