Skip to content Skip to sidebar Skip to footer

Using Jquery Noconflict() With Script.aculo.us

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, so there'

Solution 1:

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

Solution 2:

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.

Solution 3:

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();

Solution 4:

Try this:

<scriptsrc="url to jquery"></script><scripttype="javascript">jQuery.noConflict();</script><scriptsrc="url to scriptaculous"></script>

Post a Comment for "Using Jquery Noconflict() With Script.aculo.us"