twitter bootstrap - How can I avoid jQuery conflicts between 2 plugins -


i have autocomplete plugin (jquery.autocomplete.js) , using jquery carousel , using of bootstrap components. when add bootstrap.min.js , jquery-1.11.3.min.js autocomplete plugin not working. how can working.?

autocomplete working fine jquery 1.2.6 - new wave javascript

when load jquery.x.x.js, overwrite existing $ , jquery vars. keeps backup copy of them (in _$ , _jquery). calling noconflict(true) restore situation before js inclusion!

noconflict() gives running instance (the last loaded), can work version in way

resuming:

  • original page loads "jquery.versionx.js"
  • $ , jquery belong versionx
  • you call "jquery.versiony.js"
  • now $ , jquery belong versiony, plus _$ , _jquery belongs versionx
  • var my_jquery = jquery.noconflict(true);
  • now $ , jquery belong versionx, _$ , _jquery null, , my_jquery versiony

if want revert specific version add following javascript code in html.

<script type="text/javascript">     if (jquery.fn.jquery != "1.11.0")         var jquery_1_11_0 = $.noconflict(true); </script> 

https://stackoverflow.com/a/30101470/2025923


Comments