jQuery with other js framework, aka jQuery.noConlict()

Hi there!

I know its a old trick to work jquery with other js framework, but I am not a js guy. But now a days I feel that nothing can be smart in web without javascript. So I am using js vastly wherever I get chance. Last Couple of days I tried Magento CMS and developing a e-commerce site www.stylebdonline.com with some of my school friends. None of them are technical, as this business is not fully depends on Technology, some supply chain and merchandising is needed as well.

Anyway in Magento I need to use a jquery slider, but Magento by default use prototype as js framework. Here I need to use a noConflict way to use jquery in Magento. Also this technique is working any site dealing with two js framework.

Normally jquery is using $ sign but in noConflict mode, we need to define new jquery sing. As in my situation I am using $j instead of $ for jquery.

var $j = jQuery.noConflict();

// Do something with jQuery

$j("div p").hide();

// Do something with another library's $()

$("content").style.display = 'none';

This is the easiest way for me to using jquery no conflict mode. Thought there is some other ways to do same, but I am happy with this 🙂
Hope you will enjoy your jquery no conflict with other js framework.

(Visited 29 times, 1 visits today)

Leave a comment

Your email address will not be published. Required fields are marked *