views:

178

answers:

2

I currently work on a magento webshop, which loads PrototypeJS as framework.

However i need jQuery at some point to do some custom stuff.

jQuery is loaded after prototype and runs in noConflict mode.

Now, here's my demo HTML:

<div id="someID">
<div>child</div>
<div>child</div>
<div>child</div>
</div>

An external JS file is loaded and contains the following;

var $j = jQuery.noConflict();
$j(document).ready(function() {
    alert($j('#someID').children().length);
});

My alert shows '1' (on any selector) where 3 is expected.

Weird?!

A: 

Using only that code alone in a test file, I get the proper value. Is it possible that the other elements are being removed from or rearranged in the DOM using some other code?

tvanfosson
I did some debugging;As soon as scriptaculous/effects.js gets loaded my alert shows '1', otherwise '3'
Roland Franssen
+1  A: 

OK, found the solution: Script.aculo.us was outdated, i updated to the latest version and everything is just fine :)

See: http://www.magentocommerce.com/wiki/how-to/how%5Fto%5Fuse%5Fjquery%5F1.2.6%5Flastest%5Fwith%5Fprototype

Roland Franssen