Use jQuery with other libraries
We we’re recently doing some custom coding work for a client that wanted some nice jQuery effects but had already used the MooTools Javascript Library in their website.
If you’ve tried using jQuery with other libraries you’ll already know they don’t always play well together straight off. It’s pretty easy to sort this issue with the jQuery.noConflict(); function.
Okay, your typical function would look as follows:
-
-
// Put your code in document ready
-
jQuery(document).ready(function(){
-
// Do jQuery stuff
-
$("div").hide();
-
}
-
);
-
Now the fix, simply add to your function and then replace $ with jQuery.
-
-
// Add the noconflict
-
jQuery.noConflict();
-
-
// Put your code in document ready
-
jQuery(document).ready(function(){
-
// Do jQuery stuff using
-
jQuery("div").hide();
-
}
-
);
-
It really is as simple as that. Your Javascript libraries should all get along now.






