Search code examples
jqueryajaxwordpressconflict

Jquery conflict in navigation manu wordpress


I need to use these two files of jquery. But these are conflict. How can I use these two files without conflict.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>

Solution

  • You should use noconflict method for this purpost. See below:

    First load 1.11.0

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

    <script type="text/javascript"> var jQuery_1_11_0 = $.noConflict(true); <script>

    Now load 1.3.0

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>

    <script type="text/javascript"> var jQuery_1_3_0 = $.noConflict(true); <script>

    Now, use jQuery_1_11_0('#selector').function(); or jQuery_1_3_0('#selector').function();

    instead of $('#selector').function();