a few words about web development

How to use jQuery in Magento aka jQuery Compatible Mode

Bringing jQuery plugins to Magento
Magento shop uses PrototypeJS library which is registering $ symbol for itself. jQuery library wants to do the same thing, that's why in order to use jQuery in a website which uses PrototypeJS (or similar library) you need to put it into Compatibility Mode. How?
Instead of:
$(document).ready(function(){
    $("div").hide();
});
you need to write your code this way:
var $j = jQuery.noConflict();
$j(document).ready(function(){
    $j("div").hide();
});
So as you noted the difference is adding: var $j = jQuery.noConflict();
and using $j instead of $.

You can read more on this subject here: Using jQuery with Other Libraries

Comments