I noticed that a certain script I use relies on prototype. (Lightbox 2) Will it work together on the same page as jQuery? Is there way to make sure that they don;t conflict?
+6
A:
You can but you need to take special steps if you're using the $()
special function. Basically it comes down to the order you call libraries and/or calling jQuery.noConflict()
.
mopoke
2010-01-04 03:42:31
+2
A:
Use jQuery.noConflict so that you are required to make calls using the jQuery object explicitly (i.e. jQuery('#selector')
instead of the $
alias.
Michael Greene
2010-01-04 03:42:45
+2
A:
This appears to be a duplicate question: http://stackoverflow.com/questions/451362/using-jquery-and-prototype-in-the-same-page
James Kolpack
2010-01-04 03:43:16
Shh.. Don't tell anyone. I've got an answer anyhow. Thanks.
Moshe
2010-01-04 03:45:29
+2
A:
There's a huge number of lightbox clones, why not choose a jQuery one? Regardless of avoiding conflicts between the libraries, having two JS libraries on one page is a lot to download.
nickf
2010-01-04 03:48:55