memic84
memic84

Reputation: 129

jquery noConflict jquery.mobile

I am using two versions of jQuery and i want to start using jQuery mobile. See below code:

<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery-2.1.0.min.js"></script>
<script type="text/javascript">var jQuery_2_1_0 = $.noConflict(true);</script>
<script type="text/javascript" src="jquery.mobile-1.4.2.min.js"></script>

Now the problem is, that jquery.mobile recognises the 1.4.2 version of jquery.

How do i tell jquery.mobile to use the 2.1.0 version?

!! The noConflict cannot be used for 1.4.2 version, because of legacy code and one jquery version is not an option for now.

Upvotes: 1

Views: 856

Answers (1)

Kevin Roth
Kevin Roth

Reputation: 338

I know this question is old, but it's still open.

Here is a snippet of my solution:

<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/1.2.6/jquery.min.js'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js'></script>

<script>
  $(function () {
    // jQuery Mobile has loaded with the newer version of jQuery, so
    // now we set $ back to the original version of jQuery & set new version to jq2
    var jq2 = jQuery.noConflict();
  });
</script>

See the rest on CodePen: http://codepen.io/rothkj1022/pen/gapNeP

Upvotes: 1

Related Questions