Skip to content

Instantly share code, notes, and snippets.

@madeindjs
Created December 2, 2016 14:28
Show Gist options
  • Save madeindjs/7ea13d03d6699f5f84761a12bff86ff5 to your computer and use it in GitHub Desktop.
Save madeindjs/7ea13d03d6699f5f84761a12bff86ff5 to your computer and use it in GitHub Desktop.
make script execution wait until jquery is loaded
function defer(method) {
if (window.jQuery)
method();
else
setTimeout(function() { defer(method) }, 50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment