› Forums › Classic DFFS › jQuery not available in CustomJS
- This topic has 7 replies, 2 voices, and was last updated 6 years, 4 months ago by
Alexander Bautz.
-
AuthorPosts
-
-
July 14, 2017 at 11:41 #17283
Andreas Blüher
ParticipantHello Alexander,
after upgrading to 4.4.3.4 I’ve ran into another issue. When I try to use $ in my CustomJS code I’m getting an error message, which is the same when I put in a debugger and do it through console in my browser.
However, when I use “jQuery” instead of “$” it works just fine. Since it has been working before, this looks to me like a DFFS issue.
It would be really nice if you could confirm/deny this.
Kind regards
AndreasAttachments:
-
July 14, 2017 at 12:18 #17286
Alexander Bautz
KeymasterDFFS should reveal $ as a global variable along with jQuery and jQspjs. Which version of jQuery is loaded? – check it by typing this in the console or use console.log in your custom js:
jQuery.fn.jquery
Alexander
-
July 14, 2017 at 13:35 #17290
Andreas Blüher
ParticipantThe loaded version is “1.12.4”
-
July 16, 2017 at 10:58 #17294
Alexander Bautz
KeymasterIt may be an issue with either the DFFS loader, or with require.js if you are on SharePoint online.
You should however use jQuery as SharePoint sometimes overwrites $.
I’ll make a little change to the DFFS loader to see if it might be there the problem originates.
Alexander
-
July 17, 2017 at 07:48 #17299
Andreas Blüher
ParticipantHello Alexander,
I’m on SharePoint 2013 OnPremise and I was able to reproduce the issue on a second farm in a brand new Teamsite (englisch language).
If there’s anything I can help you with or more information I can provide, please let me know.
Andreas
-
July 18, 2017 at 09:27 #17317
Alexander Bautz
KeymasterCould you try v4.4.3.5 to see if there is any difference? In the DFFS_loader, I use this snippet in the loader to ensure $ is defined, but some other code might override it afterwards.
jQspjs = jQuery.noConflict(); // Ensure $ and jQuery are defined if(typeof $ !== "function"){ $ = jQspjs; } if(typeof jQuery !== "function"){ jQuery = jQspjs; } load_DFFS_files();
Alexander
-
July 20, 2017 at 15:02 #17357
Andreas Blüher
ParticipantHello Alexander,
I have to report that the issue remains when using $, but using jQuery works fine. Not sure what I can do to provide more detailled information.
Andreas
-
July 22, 2017 at 16:03 #17380
Alexander Bautz
KeymasterNot sure. If you open the dev console and type in
$
Do you get “undefined” or another function? (SP uses this namespace for some functions and may overwrite it).
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.