Referencing javascript library in content editor webpartRegex to Parse Script TagsContent Editor Webpart Javascript IssueJavascript How can I return a value for document.write in CEWP with javascriptJavascript is changing in Content Editor WebPartJavaScript window.location doesn't work in content editor webpartJavascript in CEWP queries a list every time dropdown is changed on NewForm.aspx not workingHow to check if current user belongs to SharePoint groupJavascript iframe isn't running correctlyCascading Dropdown not working with no errorsSPServices does not work in the document library

What does "landing" mean in this context?

Why does the Sun have different day lengths, but not the gas giants?

Problem with TransformedDistribution

Is it safe to use olive oil to clean the ear wax?

Does a 'pending' US visa application constitute a denial?

Calculating Wattage for Resistor in High Frequency Application?

Longest common substring in linear time

Argument list too long when zipping large list of certain files in a folder

Is there a name for this algorithm to calculate the concentration of a mixture of two solutions containing the same solute?

I am looking for the correct translation of love for the phrase "in this sign love"

Why is so much work done on numerical verification of the Riemann Hypothesis?

How do I color the graph in datavisualization?

How to explain what's wrong with this application of the chain rule?

Should I stop contributing to retirement accounts?

Removing files under particular conditions (number of files, file age)

What should you do if you miss a job interview (deliberately)?

MTG Artifact and Enchantment Rulings

What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?

Redundant comparison & "if" before assignment

A social experiment. What is the worst that can happen?

Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?

Multiplicative persistence

What is Cash Advance APR?

Creepy dinosaur pc game identification



Referencing javascript library in content editor webpart


Regex to Parse Script TagsContent Editor Webpart Javascript IssueJavascript How can I return a value for document.write in CEWP with javascriptJavascript is changing in Content Editor WebPartJavaScript window.location doesn't work in content editor webpartJavascript in CEWP queries a list every time dropdown is changed on NewForm.aspx not workingHow to check if current user belongs to SharePoint groupJavascript iframe isn't running correctlyCascading Dropdown not working with no errorsSPServices does not work in the document library













2















So i have added content editor webpart in NewForm.aspx and reading the code to javascript file called HideFields.ps1. SO the script as below:



HideFields.ps1



 <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" language="javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
<script type="text/javascript">

$(document).ready(function()

$().SPServices(
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function(xData, Status)
var xml = xData.responseXML.xml;

//If the current User does belong to the group "Test Group"
if (xml.search('Test Group') == -1)

$('td.ms-formlabel:contains("Description")').parent().hide();




);

);
</script>


The above script work as expected if i reference jquery library and SPService library externally.



What it does not work if i have save the file in the same location of this javascript file (HideFields.ps1).





<script type="text/javascript" language="javascript" src="~siteCollection/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


I tried also this one since the all the files existed in the same location





<script type="text/javascript" language="javascript" src="jquery.SPServices-0.7.1a.min.js"></script>









share|improve this question


























    2















    So i have added content editor webpart in NewForm.aspx and reading the code to javascript file called HideFields.ps1. SO the script as below:



    HideFields.ps1



     <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script type="text/javascript" language="javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
    <script type="text/javascript">

    $(document).ready(function()

    $().SPServices(
    operation: "GetGroupCollectionFromUser",
    userLoginName: $().SPServices.SPGetCurrentUser(),
    async: false,
    completefunc: function(xData, Status)
    var xml = xData.responseXML.xml;

    //If the current User does belong to the group "Test Group"
    if (xml.search('Test Group') == -1)

    $('td.ms-formlabel:contains("Description")').parent().hide();




    );

    );
    </script>


    The above script work as expected if i reference jquery library and SPService library externally.



    What it does not work if i have save the file in the same location of this javascript file (HideFields.ps1).





    <script type="text/javascript" language="javascript" src="~siteCollection/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


    I tried also this one since the all the files existed in the same location





    <script type="text/javascript" language="javascript" src="jquery.SPServices-0.7.1a.min.js"></script>









    share|improve this question
























      2












      2








      2








      So i have added content editor webpart in NewForm.aspx and reading the code to javascript file called HideFields.ps1. SO the script as below:



      HideFields.ps1



       <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
      <script type="text/javascript" language="javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
      <script type="text/javascript">

      $(document).ready(function()

      $().SPServices(
      operation: "GetGroupCollectionFromUser",
      userLoginName: $().SPServices.SPGetCurrentUser(),
      async: false,
      completefunc: function(xData, Status)
      var xml = xData.responseXML.xml;

      //If the current User does belong to the group "Test Group"
      if (xml.search('Test Group') == -1)

      $('td.ms-formlabel:contains("Description")').parent().hide();




      );

      );
      </script>


      The above script work as expected if i reference jquery library and SPService library externally.



      What it does not work if i have save the file in the same location of this javascript file (HideFields.ps1).





      <script type="text/javascript" language="javascript" src="~siteCollection/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


      I tried also this one since the all the files existed in the same location





      <script type="text/javascript" language="javascript" src="jquery.SPServices-0.7.1a.min.js"></script>









      share|improve this question














      So i have added content editor webpart in NewForm.aspx and reading the code to javascript file called HideFields.ps1. SO the script as below:



      HideFields.ps1



       <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
      <script type="text/javascript" language="javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
      <script type="text/javascript">

      $(document).ready(function()

      $().SPServices(
      operation: "GetGroupCollectionFromUser",
      userLoginName: $().SPServices.SPGetCurrentUser(),
      async: false,
      completefunc: function(xData, Status)
      var xml = xData.responseXML.xml;

      //If the current User does belong to the group "Test Group"
      if (xml.search('Test Group') == -1)

      $('td.ms-formlabel:contains("Description")').parent().hide();




      );

      );
      </script>


      The above script work as expected if i reference jquery library and SPService library externally.



      What it does not work if i have save the file in the same location of this javascript file (HideFields.ps1).





      <script type="text/javascript" language="javascript" src="~siteCollection/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


      I tried also this one since the all the files existed in the same location





      <script type="text/javascript" language="javascript" src="jquery.SPServices-0.7.1a.min.js"></script>






      2013 sharepoint-server javascript content-editor-web-part






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 19 at 6:25









      SupermodeSupermode

      1,4211025




      1,4211025




















          2 Answers
          2






          active

          oldest

          votes


















          3














          If site url like http://sp, reference the library as:



          <script type="text/javascript" language="javascript" src="/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


          If site url like http://sp/sites/team, reference the library as:



          <script type="text/javascript" language="javascript" src="/sites/team/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


          Update:



          My test result:



          enter image description hereenter image description here






          share|improve this answer

























          • I have tried this still however it is unable to load library

            – Supermode
            Mar 21 at 6:37











          • Check my test result.

            – Lee_MSFT
            Mar 21 at 6:58


















          0














          Try these 2 options -



          • Place your files in some other custom libraries other than "Site Assets" or "Style Library", and then refer it in your HTML from there.

          • Put your site in trusted locations in Internet Options settings of IE (Settings > Internet Options > Security > Trusted Sites > Sites > Add your site





          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "232"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f259616%2freferencing-javascript-library-in-content-editor-webpart%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            If site url like http://sp, reference the library as:



            <script type="text/javascript" language="javascript" src="/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            If site url like http://sp/sites/team, reference the library as:



            <script type="text/javascript" language="javascript" src="/sites/team/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            Update:



            My test result:



            enter image description hereenter image description here






            share|improve this answer

























            • I have tried this still however it is unable to load library

              – Supermode
              Mar 21 at 6:37











            • Check my test result.

              – Lee_MSFT
              Mar 21 at 6:58















            3














            If site url like http://sp, reference the library as:



            <script type="text/javascript" language="javascript" src="/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            If site url like http://sp/sites/team, reference the library as:



            <script type="text/javascript" language="javascript" src="/sites/team/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            Update:



            My test result:



            enter image description hereenter image description here






            share|improve this answer

























            • I have tried this still however it is unable to load library

              – Supermode
              Mar 21 at 6:37











            • Check my test result.

              – Lee_MSFT
              Mar 21 at 6:58













            3












            3








            3







            If site url like http://sp, reference the library as:



            <script type="text/javascript" language="javascript" src="/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            If site url like http://sp/sites/team, reference the library as:



            <script type="text/javascript" language="javascript" src="/sites/team/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            Update:



            My test result:



            enter image description hereenter image description here






            share|improve this answer















            If site url like http://sp, reference the library as:



            <script type="text/javascript" language="javascript" src="/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            If site url like http://sp/sites/team, reference the library as:



            <script type="text/javascript" language="javascript" src="/sites/team/Style Library/Scripts/jquery.SPServices-0.7.1a.min.js"></script>


            Update:



            My test result:



            enter image description hereenter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 21 at 6:58

























            answered Mar 19 at 7:44









            Lee_MSFTLee_MSFT

            2,463125




            2,463125












            • I have tried this still however it is unable to load library

              – Supermode
              Mar 21 at 6:37











            • Check my test result.

              – Lee_MSFT
              Mar 21 at 6:58

















            • I have tried this still however it is unable to load library

              – Supermode
              Mar 21 at 6:37











            • Check my test result.

              – Lee_MSFT
              Mar 21 at 6:58
















            I have tried this still however it is unable to load library

            – Supermode
            Mar 21 at 6:37





            I have tried this still however it is unable to load library

            – Supermode
            Mar 21 at 6:37













            Check my test result.

            – Lee_MSFT
            Mar 21 at 6:58





            Check my test result.

            – Lee_MSFT
            Mar 21 at 6:58













            0














            Try these 2 options -



            • Place your files in some other custom libraries other than "Site Assets" or "Style Library", and then refer it in your HTML from there.

            • Put your site in trusted locations in Internet Options settings of IE (Settings > Internet Options > Security > Trusted Sites > Sites > Add your site





            share|improve this answer



























              0














              Try these 2 options -



              • Place your files in some other custom libraries other than "Site Assets" or "Style Library", and then refer it in your HTML from there.

              • Put your site in trusted locations in Internet Options settings of IE (Settings > Internet Options > Security > Trusted Sites > Sites > Add your site





              share|improve this answer

























                0












                0








                0







                Try these 2 options -



                • Place your files in some other custom libraries other than "Site Assets" or "Style Library", and then refer it in your HTML from there.

                • Put your site in trusted locations in Internet Options settings of IE (Settings > Internet Options > Security > Trusted Sites > Sites > Add your site





                share|improve this answer













                Try these 2 options -



                • Place your files in some other custom libraries other than "Site Assets" or "Style Library", and then refer it in your HTML from there.

                • Put your site in trusted locations in Internet Options settings of IE (Settings > Internet Options > Security > Trusted Sites > Sites > Add your site






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 19 at 8:23









                Satyajit PaulSatyajit Paul

                46329




                46329



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to SharePoint Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f259616%2freferencing-javascript-library-in-content-editor-webpart%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

                    Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

                    Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?