/ Published in: JavaScript
Sometimes, you need to setup functionality before jQuery is loaded (e.g. because of a template). You can use this snippet to schedule the function after jQuery is loaded.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var checker = 0; function jqueryLoaded() { clearInterval(checker); //alert('jQuery is loaded, sire!'); } function checkJquery() { if (window.jQuery) { jqueryLoaded(); } if(checker == 0) { //alert('Setting up interval'); checker = window.setInterval(checkJquery, 100); } } checkJquery();
URL: http://stackoverflow.com/questions/2011938/load-jquery-wait