Call-back icon  Enterprise Sales: +1.310.775.2674 (N. America)   +44 20.3286.4137 (UK)

Magento

eCommerce Software for Online Growth

How to use jQuery 1.2.6 (lastest) with Prototype

Last modified by laurent on Tue, October 7, 2008 19:38
Source|Old Revisions  

Intro

jQuery can be easily used with other libraries so it should work out of the box with Magento. But in fact, it’s not... cause of an old version of scriptaculous not written with other libraries in mind.

How To

Scriptaculous

<action method="addJs"><script>scriptaculous/effects.js</script></action>

to

<action method="addJs"><script>scriptaculous/effects-1.8.1.js</script></action>

jQuery

jQuery.noConflict();
  • Rename the file to jquery-1.2.6.noConflict.min.js
  • Copy the file to the directory js/jquery/
  • In page.xml, add it to the list of js files:
<action method="addJs"><script>jquery/jquery-1.2.6.noConflict.min.js</script></action>

Use it

- 1st way (notice the function($))

  jQuery(document).ready(function($){
      // Use jQuery with $(...)
      $('div').show();
  });
  // Use Prototype with $(...)
   $('id').hide();

- 2d way

jQuery(document).ready(function(){
    // Use Prototype with $(...)
    $('id').hide();
    // Use jQuery with jQuery(...)
    jQuery('div').show();
});

Happy jQuery, jQuery plugins & jQuery UI ;)

Related Tags:  jQuery



 

Magento User Guide

Magento Enterprise Available now

Professional Services from the Magento Team

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs
© Copyright 2009 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
108693 users|439 users currently online|199761 forum posts