use several versions of jquery

0

I would like to know how I can use several versions of jquery in a single project ... I was reading something about no_conflict but I do not know how to use it, I hope your help, thanks ... (I'm using bootstrap 4 that uses jquery3.1 and I need some things that have jquery1.11 and jquery2.1.4), there is no code because I do not have any errors yet, I just want to know how to use several versions to avoid errors later

    
asked by Jhona JM 02.10.2018 в 19:09
source

1 answer

1

Taken from the following link you can do it in the following way

<!-- load jQuery 1.1.3 -->
<script type="text/javascript" src="http://example.com/jquery-1.1.3.js"></script>
<script type="text/javascript">
var jQuery_1_1_3 = $.noConflict(true);
</script>

<!-- load jQuery 1.3.2 -->
<script type="text/javascript" src="http://example.com/jquery-1.3.2.js"></script>
<script type="text/javascript">
var jQuery_1_3_2 = $.noConflict(true);
</script>

The thing with the noConflict method is that it takes out all the global variables including jQuery so you can no longer use the variable $ ahoral to do it is as follows:

// forma original (ya no servira)
$('#idElemento')
// formas con noConflict
jQuery_1_1_3('#idSelector')
jQuery_1_3_2('#idSelector')

anyway you should always consider migrating to the latest version of a library

    
answered by 02.10.2018 в 19:58