HoldReady Functions in jQuery 1.9.1

jQuery.holdReady( hold )

Holds or releases the execution of jQuery's ready event.

As I learn more about the JQuery function every day, I have looked into a very interesting function which helps to perform an operation before $(document).ready() executes.

It provides a very handy feature that delays the normal routine of execution and does an additional activity. For example you would like to depict an image for a certain amount of time or any prompt $(document).ready() executes as I've used in my other articles.

To get this feature you must download jquery-1.9.1.js and you must add it into your script folder of the solution. You can have a reference of this file from the solution I attached.

I've demonstrated the holdReady () function here and how to use it very simply.

HoldReadyfunctions1.jpg


After adding the required .js file I've appended a few lines to show how this function works.

HoldReadyfunctions2.jpg

As you can see, $.holdReady() takes a parameter as:

true: Hold the jQuery ready event

false: Release the jQuery ready event

In the code segment above, until you would not click in "OK" button of alert message it won't execute the next line to Release the jQuery ready event to perform the desired.

If I comment out the line $.holdReady(false) message then it won't execute the jQuery ready event to perform the in demand code.

Press F5 and the given window will appear.

HoldReadyfunctions3.jpg


After clicking on the "OK" button the in demand code that I've implemented in solution is executed and shows the following window:

HoldReadyfunctions4.jpg

This is a very exciting feature in this release. Have a look into this and enjoy coding.

The rest of the code implementation is from my earlier article Map() function in JQyery.

http://www.c-sharpcorner.com/UploadFile/97fc7a/array-of-values-from-an-existing-array-using-map-function-in/

The sample application has been attached as a reference.

Cheers .Net

Up Next
    Ebook Download
    View all
    Learn
    View all