Drupal uses jQuery for all its JavaScript work. This library defines the variable "$" as a shorthand for jQuery, to allow writing concise code. However, other JavaScript libraries such as script.aculo.us and prototype also use the same variable name, making it a problem to use them in Drupal!
Why would anyone think of using these libraries, since Drupal chose jQuery? Well, the main reason is that some great plugins exist for these libraries, like the LightWindow plugin that I'm trying to integrate within Drupal for a current project.
The solution came from the community, of course. For Drupal 5.x and 6.x, it is a manual solution that requires hand-editing all .js files (including those from contrib modules). Basically, the idea is to wrap each .js file within
(function ($) { ... })(jQuery);
such that the "$" variable gets bound to jQuery only within the scope of these files, instead of being bound to it globally. Other libraries are then free to use "$" when they need it. I tried it on 5.3 and it worked well as far as I could tell.
NOTE: You don't need to edit jquery.js itself, and of course don't edit the .js plugins made for other JavaScript libraries. To find all .js files that use "$", you can type:
kratib@kryptonite:/var/www/drupal$ find -name '*.js' -exec grep -Hn "<br />$(" "{}" ";"


