Home >Web Front-end >JS Tutorial >jQuery.holdReady() method usage example_jquery
The example in this article describes the usage of jQuery.holdReady() method. Share it with everyone for your reference. The specific analysis is as follows:
This method can pause or resume the jQuery.ready() event.
Calling this method can delay jQuery's ready event, which means that although the document has been loaded, the ready event handling method will not be executed.
The jQuery.holdReady() method can be called multiple times to delay jQuery's ready event. When certain conditions are met, the delay can be released one by one by setting the parameters of this method to false. This method is generally used for dynamic script loading. Once the script is loaded, you can then set the parameters of this method to false to release the delay on the jQuery.ready() event.
Grammar structure:
Parameter list:
If the value is false, the delay on the jQuery.ready() event will be released.
Example code:
Example 1:
In the above code, due to the addition of jQuery.holdReady(true), the function in ready() will not be executed even though the document is loaded.
Example 2:
After clicking to release the delay, it will pop up.
I hope this article will be helpful to everyone’s jQuery programming.