1

I have included all the js library in page.xml of my magento.

<action method="addJs"><script>lib/jquery/jquery-1.10.2.min.js</script></action>
            <action method="addJs"><script>lib/jquery/noconflict.js</script></action>
            <action method="addJs"><script>prototype/prototype.js</script></action>
            <action method="addJs"><script>prototype/validation.js</script></action>
            <action method="addJs"><script>lib/ccard.js</script></action>
            <action method="addJs"><script>scriptaculous/builder.js</script></action>
            <action method="addJs"><script>scriptaculous/effects.js</script></action>
            <action method="addJs"><script>scriptaculous/dragdrop.js</script></action>
            <action method="addJs"><script>scriptaculous/controls.js</script></action>
            <action method="addJs"><script>scriptaculous/slider.js</script></action>
            <action method="addJs"><script>varien/js.js</script></action>
            <action method="addJs"><script>varien/form.js</script></action>
            <action method="addJs"><script>mage/translate.js</script></action>
            <action method="addJs"><script>mage/cookies.js</script></action>

after that also my prototype.js is not working. I have used noconflict.js also. It was working properly before. After merging the js files it is giving the errors.

3
  • only noconflict.js this will not work you have to replace variable $ with jQuery Commented Apr 29, 2016 at 7:21
  • What should I have to do then? As I am very new to magento and javascript Commented Apr 29, 2016 at 7:29
  • 1
    add this var jQuery=$.noConflict(); in start of file every jquery related file. and replace every $ with jQuery Commented Apr 29, 2016 at 7:38

2 Answers 2

1

only noconflict.js this will not work you have to replace variable $ with jQuery add this var jQuery=$.noConflict(); in start of file every jquery related file. and replace every $ with jQuery

5
  • There are a lot of js files how it is possible to change all $ with jQuery. Commented Apr 29, 2016 at 7:52
  • you have to otherwise conflict still there. Commented Apr 29, 2016 at 7:55
  • I have replaced all $ with jQuery but it still conflicting Commented Apr 29, 2016 at 8:44
  • Previously some how it was working now totally stopped working. Commented Apr 29, 2016 at 8:45
  • i think you added some new files you need to replace it there. Commented Apr 29, 2016 at 11:00
1

go ahead and add the contents of noconflict.js directly at the end of your jquery file , this will ensure that it gets executed right after jquery is loaded

3
  • I have added the noconflict.js also but it is conflicting Commented Apr 29, 2016 at 7:28
  • @Anton S, please provide me more detail. I also faced the problem. When I merge and minify JS file, a lot of jQuery Conflict are occurred. Do I need to add noconflict.js at end of the local.xml file?
    – 502_Geek
    Commented Sep 28, 2016 at 9:53
  • you need to understand what is causing the conflict, adding something to somewhere is meaningless hack that won't get you far
    – Anton S
    Commented Sep 28, 2016 at 11:14

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.