Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery.holdReady() method

jQuery.holdReady() method

jQuery event methods jQuery event methods

Example

Right-click an HTML element to trigger the event

<button id="first">

Click to test the popup

button

<button id="second">

Remove the delay

button

<

script

$.

holdReady

(

true

)

$

(

document

)

.

ready

(

function

(

)

{

$

(

"

#first

"

)

.

click

(

function

(

)

{

alert

(

"

Popped up after the delay is removed

"

)

;

}

)

}

)

$

(

"

#second

"

)

.

click

(

function

(

)

{

$.

holdReady

(

false

)

;

}

)

script

Try it »


Definition and Usage

$The .holdReady() function is used to pause or resume the execution of the .ready() event.

**Note:** 1. This method must be called early in the document, for example, immediately after the jQuery script is loaded in the head. Calling this method after the ready event has been fired will have no effect.
2. First call $.holdReady(true) [after calling, the ready event will be locked]. When ready to execute the ready event, call $.holdReady(false).
3. Multiple locks can be added to the ready event, each corresponding to one $.holdReady(false) [unlock] call. The ready event will be triggered when all locks are removed and the page is ready.


Syntax

$

.holdReady( hold )

Parameters Description
*hold * Boolean type. Indicates whether to pause or resume the requested ready event

jQuery event methods jQuery event methods