Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Jquery is supposed to work with this technique, yet it doesn’t
 
dagobert renouf
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-07-03
 

Hello everyone,
First of all I would like to say I’ve read every magento-jquery page existing on THE INTERNET and still I don’t get why it doesn’t work.

So as we all now, we need to load our js files within the .xml layout file. Then we need to add the code “ jQuery.noConflict(); “ in the head section after the load of js files. Then when we did all that, we should be able to use jquery by remplacing “$” by “jQuery” in our code.
So i did all that.

Still this simple test code won’t work :

jQuery("h3").hide();

So I removed all the js files BUT jquery and guess what, it worked -_-.

Dear magento friends, tell me what I did wrong, because obviously the jquery file is loaded and my code is correct, the only reason would be that the noconflict fonction isn’t working, but why ?

I put this in the head after the js libs load :

<script type="text/javascript">
    
jQuery.noConflict();
</script>
 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Do you have a site I could look at with jQuery loaded?

If not, How are you loading jQuery?
Do you have Firefox with Firebug?  If so, what does Firebug say?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dagobert renouf
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-07-03
 

you can see the test page here : http://serv1.dezign.fr/mybabyz/les-bodys/test.html/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brandlive_br
Guru
 
Avatar
Total Posts:  653
Joined:  2008-05-19
Buenos Aires, Argentina
 

Good news for you.
Jquery works, but there is a little trick about version. I’m not completely sure why, but if you use Jquery version 1.2.3, there’s no problem with the integration.
After you put that version, you have to use jQuery.noConflict().

 
Magento Community Magento Community
Magento Community
Magento Community
 
dagobert renouf
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-07-03
 

Now that’s what I call a great answer.

THANK YOU BOTH GUYS !

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Man, I go to lunch and miss the boat.  Glad you got it fixed.  grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michal_s
Sr. Member
 
Total Posts:  111
Joined:  2008-05-15
The Netherlands
 

got to thank you all for the jQuery.noConflict(), helped me out also!

 
Magento Community Magento Community
Magento Community
Magento Community
 
oshipper
Member
 
Total Posts:  53
Joined:  2008-02-04
New York, NY
 

Has anyone considered/attempted removing prototype and replacing with jquery instead of trying to get them to interoperate? Pages too heavy

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brandlive_br
Guru
 
Avatar
Total Posts:  653
Joined:  2008-05-19
Buenos Aires, Argentina
 

I think that you will have some problems removing prototype.
Most of the backend functionality (javascript functions) works using prototype.

 
Magento Community Magento Community
Magento Community
Magento Community
 
oshipper
Member
 
Total Posts:  53
Joined:  2008-02-04
New York, NY
 

We would be fine leaving in the backend since will probably not use it for anything other than product management.

Prototype in the front end is a major design flaw. Mixing prototype with jquery is a serious mistake as it causes many underpowered computers to crash the browser. One non scientific test I ran on a magento implementation using both showed that it crashed Firefox 30% of the time. Not smart for an e-commerce store.

Problem is that there is 0 documentation as to where it is used. Varien has offered to provide this for $995.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top