Skip to content

Instantly share code, notes, and snippets.

@rachidbch
Last active November 30, 2018 10:54
Show Gist options
  • Save rachidbch/e0317205918fd95e9b7d72aea52a8906 to your computer and use it in GitHub Desktop.
Save rachidbch/e0317205918fd95e9b7d72aea52a8906 to your computer and use it in GitHub Desktop.
TEST: Loading JQuery with defer attribute
window.test = "Fail Init";
// test result when jQuery ready fires
$(function() { $('#resultJQ').html("jQuery result: " + window.test);});
// test result when document is ready
document.addEventListener("DOMContentLoaded", function() { $('#resultDOM').html("DOM result: " + window.test);});
window.test = "fail 1";
window.test = "pass";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment