Last active
July 28, 2017 06:36
-
-
Save yunusga/40acdf601c64e52c7646 to your computer and use it in GitHub Desktop.
Wait Until jQuery Loads
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
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