I have a conflict between jQuery and another library. I added the code below to the local.xml file as per answers found here.

<?xml version="1.0"?>
             <reference name="head">
    <action method="addJs" name="jquery" as="jquery">
    <action method="addJs">

The answer said that the noconflict.js file should simply contain the following code.

$j = jQuery.noConflict();

I do not understand where I have to add the noconflict.js file. Is it to the js folder on the server? If the answer is yes, how do I create a JavaScript file?

3 Answers 3


You can always bypass the noConflict() method by wrapping your jQuery in an IIFE: http://benalman.com/news/2010/11/immediately-invoked-function-expression/.

    //use your jQuery code here

OR just use jQuery instead of $.


Include the jquery.noConflict in the app/design/frontend/default/[theme name]/template/page/html/head.phtml file like this:

<script type="text/javascript">
  $.noConflict(); //Use no conflict here instead of js file
  // Code that uses other library's $ can follow here.

See details via following link: http://api.jquery.com/jQuery.noConflict/

  • in the header.phtml right?
    – shamz
    Commented Jan 12, 2016 at 7:02
  • @shamz head.phtml, not header.phtml Commented Jan 12, 2016 at 7:12
  • i did the same but doesnt seem to work though....
    – shamz
    Commented Jan 12, 2016 at 7:24

In the file jquery-1.11.1.js, add jQuery.noConflict(); at last.

Your Answer

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

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