How to trigger $().ready() in jQuery?

If you just need to make sure that new initialization functions get run, you don't need to do anything. When you add a new event handler in $().ready, after the document finishes loading, it will run immediately.

Apparently, calling $().trigger("ready") directly doesn't work because jQuery resets the ready event handlers after it runs them. You will need to keep track of the functions you need to call, and call them directly as below.

Of course, it might be better to just call the function directly, so you don't re-run something you didn't intend to (some plugins might have their own $().ready() functions that they don't expect to run twice).

$().ready(initializationFunction);

// later:
initializationFunction(jQuery);

You can do something like this:

$(document).on('ready readyAgain', function() {
    // do stuff
});

// At some other point in time, just trigger readyAgain
$(document).trigger('readyAgain');

Note:

$(document).on('ready') has been deprecated in jQuery 1.8 according to documentation. An alternative method is as follows:

function myReadyFunction(){}
$(myReadyFunction);

// at some other point, just call your function whenever needed:
myReadyFunction($);

What if you tried building a module execution controller right into the ready function? Kind of like this:

https://gist.github.com/miguel-perez/476046a42d229251fec3