jQuery in Magento

纵然是瞬间 提交于 2019-12-01 08:23:27
balexandre

First things first: Magento does not use jQuery.

Magento uses PrototypeJs, and either convert your jQuery into PrototypeJs or you have to load jQuery, use the noConflict method so they both run seamlessly.

To load jQuery in your page, either you use the .xml template to load it into all your pages, or if it's only in this particular page, you could simply load it before your script, for example:

<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
   // noConflict so we can use both libraries
   $.noConflict(); 

   // your current code here

//]]>
</script>

if you want to load in all pages through your design template, here is a suggestion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!