Can jQuery and Mootools work together?

后端 未结 5 902
庸人自扰
庸人自扰 2021-01-18 11:21

Can jQuery and Mootools work together??

If not when is that case?

5条回答
  •  执念已碎
    2021-01-18 11:59

    jQuery can be used in no-conflict mode:

    jQuery.noConflict();

    or could use jQuery instead of $.

    jQuery('#myelement').hide();

    As well in MooTools there's a document.id() method that could be used instead of $:

    document.id('myelement');

    In case you want to be able to use a $ you can try the snippet below:

    (function($) {
    
       $('#myelement').click(function() {
           ...
       });
    
    
    })(jQuery);
    

    By the same way you can use $ from MooTools

提交回复
热议问题