I have a third party script that is including jquery (which causes things to break). I am using 1.6 version and the external script is using an older version.
How can I force that only one version of jquery is loaded and it is the version I have on the page not the one loaded externally?
This is actually pretty easy to do, using jquery.noConfict();
<script src='jquery-1.6.js'></script>
<script>
var jq16 = jQuery.noConflict();
</script>
<script src='jquery-1.4.2.js'></script>
<script>
var jq142 = jQuery.noConflict();
</script>
You can then have functions use the $() namespace as so:
(function($) {
$('<button>Use jQuery 1.4.2</button>')
.click(function() {
alert('Top: ' + $(this).offset().top + '\n' +
'jQuery: ' + $.fn.jquery);
})
.appendTo('body');
})(jq142);
There is a more detailed example and a few extra tips on this page.