To add the jquery, plus my own file (main.js), I pasted this piece of code in my local.xml:

    <block type="core/text" name="google.cdn.jquery">
        <action method="setText">
            <text><![CDATA[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script>window.jQuery||document.write('<script src="/path/to/your/jquery.js">\x3c/script>');</script><script>jQuery.noConflict();</script>]]></text>

    <action method="addItem">

Seems alright, but when I use this function in my main.js file, it doesn't do anything. Not even a console error:


I know this will probably be marked as a duplicate, but all the answers I've found don't seem to work. I have tried changing the classname, but that also did not work.


So I found out jQuery does work, with this:

var $j=jQuery.noConflict();

But there is still a problem.


Works fine, but when I call a class, like this:


It does nothing. I checked the classname alot, and even changed a few times to test. Didn't work. Is it possible, that jQuery 1.10.2 uses another form of calling classes?


Seems I had forgotten to place the .click function within the $j(document).ready() function... stupid me

  • What happens if you use $ instead of $j ? Or directly jQuery ? – Raphael at Digital Pianism Sep 5 '16 at 14:31
  • The answer I got this from specifically said I should use $j, because of the noConflict() that was added. Using $ results in errors in the console, saying that the .click function has a property of null – Maarten Wolfsen Sep 5 '16 at 14:38
  • Using jQuery gives the exact same result – Maarten Wolfsen Sep 5 '16 at 14:38

As you mentioned that you should use $j because of the noConflict() I'm pretty you can fix your issue by replacing:



$j = jQuery.noConflict();

Edit: the problem was that the OP forgot to use $j(document).ready in its main js code.

  • It didn't do alot, except for giving a console error stating: $j(...).cycle is not a function. This error came from slideshow.js, one of the standard js files that are in the sample data – Maarten Wolfsen Sep 5 '16 at 14:43
  • @MaartenWolfsen interesting I'm not too sure what's going on here. could you check your source code and ensure you don't have another jQuery library file loaded from somewhere else ? – Raphael at Digital Pianism Sep 5 '16 at 14:46
  • I do have another jquery library file loaded, by magento itself. It's loaded by RWD default: /skin/frontend/rwd/default/js/lib/jquery-1.10.2.min.js – Maarten Wolfsen Sep 5 '16 at 14:48
  • @MaartenWolfsen that's probably what the issue is. Having the original magento jQuery library loaded + the one you're adding is causing issues – Raphael at Digital Pianism Sep 5 '16 at 14:50
  • The weird thing is, using the original magento jQuery library, it is still nog doing anything. Even while adding the $j = jQuery.noConflict(); method. – Maarten Wolfsen Sep 5 '16 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.