gary
gary

Reputation: 319

Multiple jquery in one page

I have a a jquery conflict which I cannot resolve mainly down the the fact I have no idea about it, wonder if anyone could shine a light on it for me? I have 2 scripts running, the first requests jquery.1.3.1 while the 2nd needs jquery.1.7.1, when both exist the first script doesnt work removing 1.7.1 breaks the 2nd script and so on.

Is there a way to have both play nicely on same page, I didnt write either script so not sure how I would update the 1st script to work with 1.7.1?

Kind regards

Upvotes: 2

Views: 240

Answers (1)

Sarfraz
Sarfraz

Reputation: 382696

You can put jQuery.noConflict() to use:

<script src="jquery1.7.1"></script>
<script>
$j17 = jQuery.noConflict();
</script>
<script src="jquery1.3.1"></script>

Now you can refer to jQuery 1.7.1 with $j17 and older version with $ or jQuery.

Though you should really use the latest version of jQuery.

Upvotes: 3

Related Questions