jQuery not available in CustomJS

Forums Dynamic Forms for SharePoint jQuery not available in CustomJS

Viewing 7 reply threads
  • Author
    Posts
    • #17283
      Andreas Blüher
      Participant

      Hello 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
      Andreas

      Attachments:
    • #17286
      Alexander Bautz
      Keymaster

      DFFS 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

    • #17290
      Andreas Blüher
      Participant

      The loaded version is “1.12.4”

    • #17294
      Alexander Bautz
      Keymaster

      It 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

    • #17299
      Andreas Blüher
      Participant

      Hello 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

    • #17317
      Alexander Bautz
      Keymaster

      Could 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

    • #17357
      Andreas Blüher
      Participant

      Hello 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

    • #17380
      Alexander Bautz
      Keymaster

      Not 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

Viewing 7 reply threads
  • You must be logged in to reply to this topic.