Skip to content

Instantly share code, notes, and snippets.

@dalethedeveloper
Created February 10, 2012 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalethedeveloper/1793789 to your computer and use it in GitHub Desktop.
Save dalethedeveloper/1793789 to your computer and use it in GitHub Desktop.
Safely wrap jQuery when multiple versions are present on a page
<!--
For testing how multiple versions of jQuery interact on a page,
see http://jsfiddle.net/dalesaurus/5TgkG/
-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">window.jQuery || document.write('<script src="/js/jquery-1.7.1.min.js"><\/script>')</script></script>
<script type="text/javascript">
var jQuery171 = window.jQuery;
jQuery171(document).ready(function($){
// Do work, son!
})(jQuery171);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment