1

I see this error in the firebug.

"ReferenceError: $j is not defined"

I read that it is to do with jquery file. I have following code in my theme in local.xml file.

    <default>
        <reference name="head">
            <!-- Link to external JavaScript file (e.g Jquery CDN)-->
            <block type="core/text" name="google.cdn.jquery">
                <action method="setText">
                     <text><![CDATA[<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script>window.jQuery||document.write('<script src="/skin/frontend/default/mytheme/js/jquery.min.js">\x3c/script>');</script><script>jQuery.noConflict();</script>]]></text>
                </action>
            </block>
            </reference>
            </default>

What is this error? How can I solve?

1 Answer 1

0

I think that your library is loaded after the function $j this is why it is not recognized, to solve this, try to remove the library, add your file.js then add the library like this:

local.xml

<reference name="head">
     //...
     <action method="removeItem"><type>skin_js</type><name>js/path_to_your_lib</name></action>
     <action method="addItem"><type>skin_js</type><name>js/path_to_your_lib</name></action>            
     <action method="addItem"><type>skin_js</type><name>js/yourfile.js</name></action> //where you call $j

     </reference>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.