Using jQuery and MooTools Together
jQuery is namespaced so the
$ function is free for MooTools to take hold of. The jQuery code passes jQuery to itself and then we call the argument
$, thus jQuery is contained, so to speak.
Obviously including two libraries within the same page is resource-consuming but if it's acceptable to the project and allows you to implement plugins from each library quickly, this may be a great option for you.
Definitely will be referring back to this. Thanks, David!
First and foremost, we, as web developers should always make an effort to only use one library – and put forth the time and effort to only utilize ONE library at a time. If someone wants a jquery plugin, they should rewrite it for mootools. If they want a class from mootools, that should write it for jquery.
I’d like to accentuate the “just because it’s easier” – as it does happen sometimes where you’re put in a situation where rewriting a mootools class or a jquery plugin isn’t feasible (generally speaking, time constraints coupled with financial issues), so it’s bound to happen. I just hope web developers don’t look at the “noConflict()” option as a “I can always be lazy” and do their best to utilize one library.
And I’m totally with you on knowing more than one – and rewriting jQuery for MooTools and vice-versa has been my best method to learning and understanding how the two libraries function.