I have been working on SharePoint 2013 recently, and noticed that under variation sites, SharePoint 2013 has a java script file that defines a global variable called $
which overwrites the jquery $ and brakes all my code. Other solutions say to wrap it with a self executing anonymous function passing in jQuery.noConflict and making the parameter name $.
http://chuvash.eu/2012/06/01/in-cmssitemanager-js-conflicts-with-in-jquery/
http://api.jquery.com/jQuery.noConflict/
I was just wondering, since SP2013 has been out for years now and I never heard of this problem before, is this really a big problem or did someone find a fix for it?
I don't want to have to update all my jquery uses with with code since there is a lot of them.
$
object between jQuery and SharePoint's out of the box JavaScript. They even perform similar functions (like selecting elements) but the behavior is different. Usually this isn't an issue if you wrap your code in one of theSP.SOD
methods since SharePoint's built-in code has already run by the time jQuery gets loaded and called. The SharePoint code has a whole interface I'll let someone else describe in an answer thoughSP.SOD.executeOrDelayUntilScriptLoaded(myAwesomeFunctionDefinedBelow, "sp.js")
is one example, take a look at the MSDN SP.SOD Methods Page for more info