two version of Jquery conflict

自作多情 提交于 2019-12-06 02:25:43

Though there is no problem in your scripts but you still may want to try this

var k=jQuery.noConflict();

and replace the $ with k in the new JS you are writing like this

j(document).ready(function(){
     alert('hey I am not conflicting with any other jquery script');
});

EDIT

Add the var k=jQuery.noConflict(); on the top of your javascript and replace all your $ in your JS with j.. j is nothing but a new jQuery object which is created by us and performs all functions that are performed by $ but does not conflict with any other jQuery file on the page..

Example: If you have

$(document).ready(function(){
     $('#selector').click(function(){
          alert('Hi');
     });
});

it should be written like

j(document).ready(function(){
     j('#selector').click(function(){
          alert('Hi');
     });
});

after using the noConflict..

Edit-2:

One of the other possible reason for your tabs not working can be the older version of jquery you are using

You are using a higher version of jQuery UI and a lower version of jQuery, Which can be a possible reason.. Try replacing the follwing scripts

<script type="text/javascript" src="http://www.nyimexec.com/wp-includes/js/jquery/jquery.js?ver=1.7.2"></script>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js?ver=1.8.21"></script>

with

<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>


<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" type="text/javascript"></script>

Hope it helps...

You should list the versions from largest to smallest.

Example:

<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.0/jquery-ui.min.js?ver=1.0'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.0.1/jquery-ui.min.js?ver=1.0.1'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.2.1/jquery-ui.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.3.0/jquery-ui.min.js?ver=1.3.0'></script>

And so on...

The two libraries are not same. One is the jQuery and other is the jQueryUI library which can be used together without any problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!