This project has moved and is read-only. For the latest updates, please go here.

Problem with scripts conflicting

Sep 21, 2010 at 4:37 AM

I'm building menu using the 

jkmegamenu plugin

from here

My data comes from a list using the

I'm sure the menu works because when i remove the
jquery.SPServices-0.5.6.min.js and hard code the HTML the menu does work i think the SPServces.js is conflicting with the 
Any ideas how to not make it conflict.Do i have to load the js in Jquery?
Thanks in Advance

 This is the way i reference the script below:

script type="text/javascript" src="_layouts/jQuery/jquery-1.4.2.min.js"></script> <script src="_layouts/jQuery/jkmegamenu/jkmegamenu.js" type="text/javascript"></script> <script src="_layouts/jQuery/jquery.SPServices-0.5.6.min.js" type="text/javascript"></script> <script type="text/javascript"> //jkmegamenu.definemenu("anchorid", "menuid", "mouseover|click") jkmegamenu.definemenu("megaanchor", "megamenu1", "mouseover") </script>


Sep 21, 2010 at 6:56 AM

Oops got it working.
After pulling my hair off. I taught i should look at the jkmegamenu.js code and i noticed
he had   $Jquery.noConflict();
commented it out and it worked like a charm



Sep 23, 2010 at 3:26 AM

Nice to see you solved it without our help!


Jun 18, 2016 at 10:41 AM
I realize this is a very old thread, but it would be nice if SPServices were to appropriately handle a case where noConflict was called.

Like this if you need to support cases where jQuery.noConflict(true) is called:
(function($) {
$.fn.lazyPlugin = function(opt) { // ... }
})(jQuery || _jQuery);
Jun 18, 2016 at 2:46 PM
SPServices already properly initializes itself by using the jQuery global variable and not $ global variable, so whatever problem you had, its likely that SPServices was not the root cause.

What I have seen repeadtely as a problem is:

- Unknown to the user, the pages loads multiple versions of jQuery. SPServices will initialize using whatever version is global at the time the of initialization

- other logic is not properly referencing jQuery (ex: using global $ instead of an IIFD that creates private scoped $ that points at jQquery global variable )

Hope this helps.

-- sent from mobile