Is it possible to use mootools and jQuery together

I need to use mootools and jquery files. But there is a conflict with the simultaneous use of both. Is there a solution to avoid this conflict?

+3
source share
2 answers

Yes, you will need to enable this code immediately after enabling jQuery and before you enable Mootools.

<script>
    var j$ = jQuery.noConflict();
</script>

Then you will want to find / replace all jQuery links $with j$, preferably using the automatic tool found in most code editors.


You also have another option - closing. It will look something like this if I remember correctly:

(function($) {
  //jQuery stuff
})(jQuery);

. $, jQuery, , , Mootools .

+6

All Articles