Created
January 9, 2013 07:51
-
-
Save iwaffles/4491414 to your computer and use it in GitHub Desktop.
Wait for jQuery to be loaded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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