Jquery plugins use different versions, how to bypass?

Asked

Viewed 885 times

2

Good afternoon I’m using the pluign jQuery Knob who uses the version 1.9.0 of the jquery, and the Mask-input who uses the v1.11.1.

Maskinput

I used the latest version and it worked, so I think maskinput is not the problem.

Jquery Knob

Only works in version 1.9.0 and if I put any other it does nothing and no error in the console appears.

The Big Problem

It is when I use src and map both versions of jquery that this error appears what I should do?

Uncaught Error: jquery Knob's JavaScript requires jquery Knob version
1.9.0 or higher, but lower than version 3 at jquery Knob.js:6 
at jquery Knob.js:6
  • I did some searches on the internet and had some tutorials teaching to use the 2 versions but did not understand how to do.

  • https://stackoverflow.com/a/1566644/6510304

1 answer

2


Yes, with the jQuery.noConflict() you can do something like this:

<script type="text/javascript" src="jquery-1.9.0.js"></script>
<script> $190 = jQuery.noConflict();</script>
<script type="text/javascript" src="jquery-1.11.0.js"></script>

And then use both $190 and $ in your code. Ex:

$('#seletor').function(); ou $190('#seletor').function();
  • The $190 takes the value of src before declaration?

  • It takes what is in the current scope of JS. For this case, use instead to isolate only the content of legacy JS.

  • Gave straight @Lucasmatias, and I dumb wasting a good time looking hahahaha

Browser other questions tagged

You are not signed in. Login or sign up in order to post.