I have a site using a \"widget\" (from http://healcode.com) that includes the script.aculo.us JavaScript library. The problem is that the site I\'m building is on WordPress,
This worked for me so that I can have jQuery and script.aculo.us/Prototype working well together. Credit goes to codeimpossible for this lifesaver!
Instead of:
jQuery(document).ready(function () {
// Code to run on DOM ready
}); // End document.ready
Try this:
( function($) {
// Code to run on DOM ready
} )( jQuery ); // End document.ready
Try this:
<script src="url to jquery"></script>
<script type="javascript">jQuery.noConflict();</script>
<script src="url to scriptaculous"></script>
I found the solution VERY surprising!
First of all, using the $j = jQuery.noConflict();
mode did not work.
Second, calling jQuery.noConflict();
at the head did not work.
The method that did work was this one: http://codeimpossible.com/2010/01/13/solving-document-ready-is-not-a-function-and-other-problems/
Oddly, the Coda Slider 2.0 plugin does not automatically do noConflict
so it turned out that IN ADDITION to the problems listed above, I needed to wrap that plugin in .noConflict();
as well. Shout out the the author of the blog post, not sure why other noConflict();
calling methods didn't work, but I'm glad I found the post.
Assigning jQuery right back to $
doesn't do anything.
Either assign jQuery to a different variable:
var j$ = jQuery.noConflict();
Or don't assign it to anything:
jQuery.noConflict();