I dug up some old code that looks for a particular version of jQuery and loads it if it's not found plus it avoids conflicting with any existing jQuery the page already uses:
// This handles loading the correct version of jQuery without // interfering with any other version loaded from the parent page. (function(window, document, version, callback) { var j, d; var loaded = false; if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://code.jquery.com/jquery-2.1.0.min.js"; script.onload = script.onreadystatechange = function() { if (!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) { callback((j = window.jQuery).noConflict(1), loaded = true); j(script).remove(); } }; (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script); } })(window, document, "2.1", function($) { $(document).ready(function() { console.log("Using jQuery version: " + $.fn.jquery); // Your code goes here... }); });