top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is jQuery.holdReady() function?

+2 votes
What is jQuery.holdReady() function?
posted Sep 21, 2014 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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)".

$.getScript("myplugin.js", function() {

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.

answer Sep 25, 2014 by Deepak Negi
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.