Skip to main content

jQuery/Thickbox + Prototype/Scriptaculous = ?

So, I wanted to implement jQuery/Thickbox in an environment that already were using Prototype/Scriptaculous. The problem you see here is that both jQuery and Prototype use the same $ syntax. Lucky me there's a solution to this problem.

jQuery.noConflict();

This will let you use all jQuery functionality but with jQuery() instead of $(). So, to be able to use thickbox with this, you need to download the uncompressed thickbox code, add the noConflict statement at the beginning, and then exchange all $() with jQuery().

Like this:

// enable noConflict-mode
jQuery.noConflict();

// instead of this $(document).ready(function(){ });

// you now do this instead jQuery(document).ready(function(){ });

Beware of regex and other constructs that also use $. Don't do replace-all in your thickbox.js, because it just won't work. Thickbox is a small framework and it will take you just a minute to manually go through it and replace all jQuery calls.

comments powered by Disqus