getting thickbox, jquery, and prototype to play together nicely
The latest version of the JumpBox admin interface uses ThickBox for its cool visual effects, and prototype for handling AJAX requests. The problem is that ThickBox depends on jQuery, and jQuery and prototype don’t like working together.
Both jQuery and prototype define “$” as an alias in the global namespace. When you try to use the “$” shortcut and both libraries are included, the browser complains. Lucky jQuery gives you a way to override “$” and let prototype use it thus resolving the conflict:
<html>
<head>
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>
jQuery.noConflict();
</script>
</head>
<body>

September 27th, 2007 at 11:45 am
Love you lots!
Scriptaculous/Prototype and Thickbox/jQuery now play nicely.
September 27th, 2007 at 5:01 pm
Nice! Glad I could help =)
November 15th, 2007 at 5:14 pm
Excellent..Great Help.
December 16th, 2007 at 9:11 am
Thank you ! You are a life saver
January 11th, 2008 at 4:02 am
Great help!!
I have been googling for whole week for this answer!!
March 19th, 2008 at 10:52 am
Thank you very much. I found this fix on the net easily. Also, I found it easy to implement. I am two months out on a bad project and I need to finish today or die. I cannot imagine how long this would have delayed me if you did not put up this article.
March 19th, 2008 at 10:54 am
No problemo Jared! Good luck on getting your project out the door.
May 11th, 2008 at 3:45 am
Thanks so much. You saved me a ton of troubleshooting time. Great post.
May 11th, 2008 at 7:08 pm
Thanks for the advise, but I still can’t get it to work. I’m getting a “undefined is not a function” error from the thickbox-compressed.js file.
I’m calling the thickbox event via an onload function in my body tag which calls:
function init()
{
tb_show(’Update’, ‘updates.html?height=550&width=600′, null);
}
I’m calling it from there because I want the thickbox to popup on page load without having to click on any links.
May 15th, 2008 at 3:03 am
Great! Now I can have thickbox AND scriptaculous working together. Thanks!
June 6th, 2008 at 7:39 am
thanks a lot this helped me huge. Im so glad there is a community out there that will support each other.
July 14th, 2008 at 4:40 am
So simple when you read about it, thanks for posting
September 7th, 2008 at 2:24 am
I already gave up since rewriting everything to use jQuery wasn’t really an option. And then I found this site! Thanks for the solution!
September 19th, 2008 at 7:11 am
thanks. saved my hide.
October 15th, 2008 at 3:21 am
awesome stuff,
one thing though, after changing all your $ calls to jQuery in the thickbox.js file and putting in jQuery.noConflict(); for it to not conflict; you also need to do this,
tb_init(’a.thickbox, area.thickbox, input.thickbox’);
to make thickbox latch onto anything with a class of ‘thickbox’,
or with google ajax api….
google.load(”jquery”, “1.2.6″);
jQuery.noConflict(); //now make jQuery not conflict with prototype
tb_init(’a.thickbox, area.thickbox, input.thickbox’);
December 4th, 2008 at 1:06 am
Thanks for your tip. It helped me a lot. Your blog was first in google when i searched for this problem. Great work!
December 19th, 2008 at 3:07 am
You really saved me some days of work!!!
Thanks a lot.
February 24th, 2009 at 10:02 pm
I. Love. You.
Thank you for this, helped a ton.
March 24th, 2009 at 11:51 am
FYI, if you use the compressed version of thickbox the search and replace doesn’t work right. Make sure and grab the thickbox.js that isn’t compressed, then replace “$” with “jQuery”.
March 30th, 2009 at 2:41 pm
thank you SO much! basically saved my life.
September 21st, 2009 at 4:51 am
Thanks a lot !
September 28th, 2009 at 11:04 am
Thanks for your help… This saved me a lot of time trying to figure it out my self
October 6th, 2009 at 7:37 am
dude ur the best
October 14th, 2009 at 11:08 pm
thanks a lot…
December 7th, 2009 at 10:29 pm
Thanks a lot. You saved me…
December 31st, 2009 at 12:14 am
Thanks for this post. Great.
January 22nd, 2010 at 12:47 am
ohhhh,
thats gr8
thank you
February 5th, 2010 at 1:53 am
This tip and Nate’s information not to use the compressed version of ThickBox made my day !
Thanks a lot !