Skip to content

Instantly share code, notes, and snippets.

@sebnilsson
Last active December 9, 2015 19:29
Show Gist options
  • Save sebnilsson/4317014 to your computer and use it in GitHub Desktop.
Save sebnilsson/4317014 to your computer and use it in GitHub Desktop.
Update jQuery on-the-fly in Javascript
console.log($().jquery); // Show original jQuery-version
// Closure
var $gs = $.getScript;
// http://api.jquery.com/jQuery.noConflict/
// jQuery.noConflict( [removeAll] )
// removeAll: A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
$.noConflict(true);
// Get script
$gs('http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', function() {
console.log($().jquery); // Show updated jQuery-version
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment