Comments on: jQuery.noConflict() https://w3lessons.info/jquery-noconflict Tutorials on PHP, jQuery & Amazon Web Services Mon, 26 Dec 2011 10:22:00 +0000 hourly 1 https://wordpress.org/?v=6.6.2 By: Anonymous https://w3lessons.info/jquery-noconflict#comment-56 Mon, 26 Dec 2011 10:22:00 +0000 http://w3lessons.info/?p=255#comment-56 In reply to Asho.

you can use both together! Since MooTools is prototype-based and jQuery is not, jQuery and MooTools may be used together on the same page.

//no conflict jquery
jQuery.noConflict();
//jquery stuff
(function($) {
$(‘p’).css(‘color’,’#ff0000′);
})(jQuery);

//moo stuff
window.addEvent(‘domready’,function() {
$$(‘p’).setStyle(‘border’,’1px solid #fc0′);
});

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.

hope this helps.. 🙂

]]>
By: itzurkarthi https://w3lessons.info/jquery-noconflict#comment-58 Mon, 26 Dec 2011 10:22:00 +0000 http://w3lessons.info/?p=255#comment-58 In reply to Asho.

you can use both together! Since MooTools is prototype-based and jQuery is not, jQuery and MooTools may be used together on the same page.

//no conflict jquery
jQuery.noConflict();
//jquery stuff
(function($) {
$(‘p’).css(‘color’,’#ff0000′);
})(jQuery);

//moo stuff
window.addEvent(‘domready’,function() {
$$(‘p’).setStyle(‘border’,’1px solid #fc0′);
});

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.

hope this helps.. 🙂

]]>
By: Asho https://w3lessons.info/jquery-noconflict#comment-55 Mon, 26 Dec 2011 10:12:00 +0000 http://w3lessons.info/?p=255#comment-55 what to use if we need to use another javascript library like mootools??? is this same function noConflict() works???

]]>
By: Asho https://w3lessons.info/jquery-noconflict#comment-57 Mon, 26 Dec 2011 10:12:00 +0000 http://w3lessons.info/?p=255#comment-57 what to use if we need to use another javascript library like mootools??? is this same function noConflict() works???

]]>
By: Asho https://w3lessons.info/jquery-noconflict#comment-1433 Mon, 26 Dec 2011 10:12:00 +0000 http://w3lessons.info/?p=255#comment-1433 what to use if we need to use another javascript library like mootools??? is this same function noConflict() works???

]]>