views:

162

answers:

3

I am having trouble running two javascript files on the same page. I used JQuery.noConflict() (http://api.jquery.com/jQuery.noConflict/) but no luck.

        <script src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
        <script>
            google.load("prototype", "1.6.0.3",{uncompressed:false});
            google.load("scriptaculous", "1.8.1",{uncompressed:false});
        </script>
        <script src="js/jquery.tools.min.js"></script>
        <script type="text/javascript">
          $jQuery.noConflict();
          jQuery(document).ready(function($) {
                $("#download_now").tooltip({ effect: 'slide'});
          });

            function show_text() {
            new Ajax.Request('./new.php', {
                             method: 'post',
                             parameters: { userid: $('userid').value },
                             onSuccess: function(r) { $('update').update(r.responseText) }
                                 });    
            }

            document.observe("dom:loaded", function() {

            $('loading').hide();

            Ajax.Responders.register({
              onCreate: function() {
                new Effect.Opacity('loading',{ from: 1.0, to: 0.3, duration: 0.7 });        
                new Effect.toggle('loading', 'appear');


              },
              onComplete: function() {
                new Effect.Opacity('loading', { from: 0.3, to: 1, duration: 0.7 });
                new Effect.toggle('loading', 'appear');
              }
            });
            });         
            </script>
+5  A: 

i believe $jQuery.noConflict(); in your code is a typo use jQuery.noConflict(); also if you can remove all $ signs with jQuery (provided $ is referrring to jQuery methods) then also your problem can be solved.

sushil bharwani
yes it is `jQuery.noConflict();`
TheVillageIdiot
+2  A: 

load jQuery first and then call this code:

var $jq = jQuery.noConflict();
//Now you can use $jq in place of $ for jQuery;
$jq(".myButton").css("border","2px");

Load other libraries.

TheVillageIdiot