Skip to content

Instantly share code, notes, and snippets.

@iwaffles
Created January 9, 2013 07:51
Show Gist options
  • Save iwaffles/4491414 to your computer and use it in GitHub Desktop.
Save iwaffles/4491414 to your computer and use it in GitHub Desktop.
Wait for jQuery to be loaded
var checker = 0;
function jqueryLoaded() {
clearInterval(checker);
console.log("jquery is loaded!");
}
function waitForJquery() {
if (window.jQuery) {
jqueryLoaded();
}
if(checker === 0) {
checker = window.setInterval(checkJquery, 100);
}
}
waitForJquery();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment