Schogini is Magento2 ready. Are you?

Get started with Magento 2 | Need expert Magento2 support?

How to include jQuery in Magento


Category: Magento 1.9

In your theme's layout.xml file add a section like this

<default>
    <reference name="head">
        <action method="addItem">
            <type>skin_js</type>
            <name>js/lib/jquery-1.10.2.min.js</name>
        </action>
        <block type="core/text" name="google.cdn.jquery">
            <action method="setText">
                <text>
                <![CDATA[<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
                </script>
                <script>
                window.jQuery||document.write('<script src="/skin/frontend/rwd/default/js/lib/jquery-1.10.2.min.js">
                \x3c/script>
                ');</script>
                <script>
                jQuery.noConflict();</script>
                ]]>
                </text>
            </action>
        </block>
    </reference>
</default>

Now, instead of $() use jQuery() to use jQuery functions / features wherever needed


 

Schogini's customer service extends beyond the natural boundaries. ~ Timothy Johnson

Schogini assures 24x7 - 6 hour turn around ticket response time and 24 hour Email response time (support@schogini.com)