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:


 <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() {

      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)




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>

2 Answers 2


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>


My test result:

enter image description here enter image description here

  • I have tried this still however it is unable to load library
    – Supermode
    Mar 21, 2019 at 6:37
  • Check my test result.
    – Lee
    Mar 21, 2019 at 6:58

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.