resolving $ is not a function when using SP Services RRS feed

  • Question

  • Hi all,

    I need your help on this.
    On the editform of an item, i have added a cEWP and hiddent the default editform webpart. The CEWP calls a html file which references jquery and spservices. The html shows a few fields of the SP List item one among which is a multiline text field called comments where I display all the versions of a comment using  spservices, getversioncollection method,

    But this showed $ is undefined for the SPServices. For this I added a 
    var JQ=jQuery.noconflict(true);
    and I was able to use JQ in the the SPServices method. This code was called from the document.ready, e.x.



    There are buttons on the form which have jquery functionality. All of this was working fine. Now when i moved the code to another environment, I get the error '$ is not a function' inside the button click events. When I comment the GetComments code, the button functionality works. I am not sure how to resolve this as the same code is working in one system but not another. Kindly help.
    Saturday, January 14, 2017 10:48 AM

All replies

  • I was able to reproduce similar situation in script below. Can someone tell me how to fix this?

    <!DOCTYPE html>
    <script src=""></script>
    function LoadData()
            $("p").text("jQuery is still working!");
    function DisplayComments()
      var j=$.noConflict(true);
      j("p").append("<br>conflict jQuery is still working!");
    function foo()
     $("p").append("<br>jQuery is not recognized here");
    <p>This is a paragraph.</p>
    <button onclick='foo()'>Test jQuery</button>

    Saturday, January 14, 2017 3:44 PM
  • Got it working by 
    function DisplayComments()
     //Call SPServices using jQuery().SPServices...
      jQuery("p").append("<br>removed noConflict,used jQuery and jQuery is still working!");

    Sunday, January 15, 2017 5:33 AM
  • Hi,


    You could mark your solution as answer, it may help others who has similar.


    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Tuesday, January 17, 2017 8:05 AM