Quantcast
Channel: Azhar Kamar » jQuery
Viewing all articles
Browse latest Browse all 4

Solving jQuery Conflicts with other JavaScript Libraries

$
0
0

I was developing a page that for some reason had to use 3 different JavaScript libraries (jQuery, MooTools and Highslide) and got into so much problems. Largely because the different libraries were conflicting with each other.

So I found this thing that helped me: http://api.jquery.com/jQuery.noConflict

I just added the ‘$.noConflict();’ method and changed the ‘(function($ {‘ sign to ‘jQuery(document).ready(function($) {‘.

It solved all the conflicts for me. ;)

How to Add the noConflict() Script for jQuery

<script type="text/javascript" src="other_lib.js">
<script type="text/javascript" src="jquery.js">
<script type="text/javascript">
  $.noConflict();
  jQuery(document).ready(function($) {
    // Code that uses jQuery's $ can follow here.
  });
  // Code that uses other library's $ can follow here.
</script>


Viewing all articles
Browse latest Browse all 4

Trending Articles