Is it possible to hold or delay document.ready execution for sometime?

Answer Posted / chaitanya

Yes, its possible. With Release of jQuery 1.6, a new method "jQuery.holdReady(hold)" was introduced. 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.

Hide Copy Code



$.holdReady(true);

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

$.holdReady(false);

});

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of jquery?

480


Explain how jquery works?

511


How to control page titles in jquery mobile? : jquery mobile

441


Explain the difference between jquery-x.x.x.js and jquery.x.x.x min.js?

412


What is slice() method in jquery?

452






What to do to select element having a particular class (".selected")? : jquery mobile

481


Why we need jquery mobile? : jquery mobile

460


How to multiple AJAX requests be run simultaneously in jQuery?

426


Is jquery is json library file or a javascript?

439


How to use css() in jquery?

456


Is jQuery is a client or server scripting?

495


What are selectors in jquery? Explain

468


What is the difference between $(window).load and $(document).ready function in jquery?

416


What is resize() function in jquery?

508


How can you select all elements in a page using jquery?

465