Skip to content

Instantly share code, notes, and snippets.

@yunusga
Last active July 28, 2017 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yunusga/40acdf601c64e52c7646 to your computer and use it in GitHub Desktop.
Save yunusga/40acdf601c64e52c7646 to your computer and use it in GitHub Desktop.
Wait Until jQuery Loads
function defer(callback) {
if (window.jQuery) {
callback();
} else {
setTimeout(function() {
defer(callback)
}, 100);
}
}
defer(function () {
alert('jQuery is now loaded');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment