This question already has an answer here:

I cannot include Jquery in magento because after including jquery-2.2.2.min.js in magento admin side,it have conflict with prototype.js. Adding $.noConflict(); can remove the conflict,but the jquery will not work then.This is the actual problem.

marked as duplicate by liyakat, sv3n, Siarhey Uchukhlebau, Prince Patel, benmarks Jul 11 '17 at 12:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • what do the 2 tags magento2 and magento-1.7 mean? – LucScu Jul 11 '17 at 7:06
  • I mean magento-1.I removed the tags – amrutha Jul 11 '17 at 7:32
  • jQuery.noConflict() removes the conflict (not $.noConflict() because $ still belongs to Prototype.js). Please show an example of a script that does not work then. You probably use $ in the global scope. Instead you should either use jQuery, or wrap any jQuery code in a closure like this: (function($) { .... })(jQuery); – Fabian Schmengler Jul 12 '17 at 9:10
  • i think this question and this user could be removed from SO. – LucScu Jul 18 '17 at 7:19

You can just include jquery using below way, in template file,

      ///your jquery code
  • But its showing require is not defined.Cannot use this script – amrutha Jul 11 '17 at 6:22
  • Run php command from your magneto root, php bin/magento setup:static-content:deploy – Rakesh Jesadiya Jul 11 '17 at 6:23
  • I didn't get you. Actually when iinclude jquery in my phtml file it have conflict with prototype.js. It can avoid using your method? – amrutha Jul 11 '17 at 6:40
  • can you show your full code? – Rakesh Jesadiya Jul 11 '17 at 6:46
  • actually include <script src="<?php echo Mage::getBaseUrl('js') ?>hpp/jquery-2.2.2.min.js" type="text/javascript"></script> in magento admin – amrutha Jul 11 '17 at 6:51
  1. Place your jquery file in js directory

  2. Add the following code to your layout .xml file in respective handle. For Ex: to reflect in all pages

This should fall under <reference name="head">

  <action method="addJs">

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