views:

34

answers:

1

Hi Good people,

Please help me i have lost 1.5 days trying to fix this, i have looked for various solutions on the internet and none seems to work,atleast for me.I have been using

jQuery.noConflict();
var $j = jQuery;

to avoid jquery conflicting with other libraries successfully, but now it wont work with prototype.I am pulling hairs and getting very annoyed at this.Someone out there please help. You are a God to me and your help is very much appreciated.

+2  A: 

Wrap all of your jQuery with this:

(function($){

})(jQuery);

And you also need to have jQuery.noConflict() outside of that code.

Radu
Hi Radu, thanks for your rapid response.Let me get something straight..do you mean<script>jQuery.noConflict();var $j = jQuery;(function($){jQuery(document).ready(function(){//then other jquery lines here})})(jQuery);</script>Thanks again
Juelz Kimilu
@Juelz Kimilu That's correct except you do not need the var $j declaration at all. Let me know if it works out. Or better yet, post up some code on http://jsfiddle.net.
Radu
Ok let me explain and be more specific...am trying integrate Anant Garg chat which uses jquery with my site which is based on phpontrax whose jshelper utilizes the prototype plugin..on my site it works only if i disable prototype, when i include it the whole throws exceptions and the chat.js does not work.I have tried ua remedy it does not seem to help either..
Juelz Kimilu
This are my js libraries included in that order//tabbed pannels<?php echo javascript_include_tag("SpryTabbedPanels") ?>//remember open tab<?php echo javascript_include_tag("spryutils") ?>//Javascript helper<?php echo javascript_include_tag("lib/prototype.js.new") ?><?php echo javascript_include_tag("lib/scriptaculous") ?><?php echo javascript_include_tag("lib/modalbox") ?><?php echo javascript_include_tag("jquery132.js") ?><?php echo javascript_include_tag("chat") ?>
Juelz Kimilu
<?php echo javascript_include_tag("jquery.qtip.js") ?><?php echo javascript_include_tag("lib/jquery.ui.all.js") ?>//file uploader<?php echo javascript_include_tag("uploadify/swfobject.js") ?><?php echo javascript_include_tag("uploadify/jquery.uploadify.v2.1.0.min.js") ?><?php echo javascript_include_tag("jqmodal") ?>
Juelz Kimilu
Each one of those jQuery plugins needs to be wrapped as well.
Radu