BugMonkey: I want to use jQuery X.Y, but FogBugz only includes jQuery [version older than X.Y] - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com2013-05-21T06:09:23Zhttp://fogbugz.stackexchange.com/feeds/question/10707http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://fogbugz.stackexchange.com/questions/10707/bugmonkey-i-want-to-use-jquery-x-y-but-fogbugz-only-includes-jquery-version-olBugMonkey: I want to use jQuery X.Y, but FogBugz only includes jQuery [version older than X.Y]db2012-08-15T14:06:20Z2012-08-29T14:22:00Z
<p>I write lots of <a href="http://fogbugz.stackexchange.com/questions/5520" rel="nofollow">BugMonkey scripts</a>, but FogBugz doesn't include the version of jQuery I'd like to use.</p>
<p>How can I include the latest version of jQuery with my BugMonkey script without changing the version of jQuery that FogBugz itself uses (i.e., without potentially breaking FogBugz)?</p>
http://fogbugz.stackexchange.com/questions/10707/bugmonkey-i-want-to-use-jquery-x-y-but-fogbugz-only-includes-jquery-version-ol/10708#10708Answer by db for BugMonkey: I want to use jQuery X.Y, but FogBugz only includes jQuery [version older than X.Y]db2012-08-15T14:17:16Z2012-08-15T14:17:16Z<p>FogBugz includes a copy of jQuery on every page, but the version of jQuery shipped with FogBugz (which varies between versions of FogBugz) might not be the one you need.</p>
<p>First, you can always check what version of jQuery is bundled with FogBugz by opening your browser's JavaScript console and evaluating: <code>jQuery.fn.jquery</code></p>
<p>If the version of jQuery included with FogBugz isn't the version you need, you can work around this using the following code:</p>
<pre><code>$.getScript('//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', function() {
// do stuff that requires latest jQuery 1.X via jQuery or $
// alias latest jQuery 1.X as window.jQueryLatest and return
// jQuery and $ to the version of jQuery included with FogBugz
window.jQueryLatest = jQuery.noConflict(true);
});
</code></pre>
<p>That script will download the latest version of jQuery 1.X from Google's CDN and inject it into the page. You can then use the latest version of jQuery from within the <code>getScript</code> callback function. At the end of the callback, we use jQuery's <code>noConflict()</code> method to return control of <code>jQuery</code> and <code>$</code> to the version of jQuery that ships with FogBugz.</p>
<p>After this script (and it's callback) have executed, <code>window.jQueryLatest</code> will store a reference to the latest version of jQuery 1.X.</p>
<p>If there is a specific version of jQuery that you'd like to use, check out <a href="https://developers.google.com/speed/libraries/devguide#jquery" rel="nofollow">Google's CDN documentation page</a>.</p>