Skip to content

Instantly share code, notes, and snippets.

@blogjunkie
Created June 13, 2021 14:17
Show Gist options
  • Save blogjunkie/9a187bb5e30f6c9fa9c4c5e80de8caeb to your computer and use it in GitHub Desktop.
Save blogjunkie/9a187bb5e30f6c9fa9c4c5e80de8caeb to your computer and use it in GitHub Desktop.
Mimic defer script for inline JavaScript
<script>
// Load only after DOMContentLoaded event
window.addEventListener('DOMContentLoaded', function() {
(function($) {
// do something
})(jQuery);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment