1

Closed

Issue referencing SPServices?

description

So I am new to JQUERY and SharePoint design/administration, and I needed a way to enlarge multiselect boxes, so the content in the box on the form can be read. I found your tools using a web search, and I read your documentation.

My first script is simply this:
<script type="text/javascript" src="https://esites.mysite.com/sites/mysite/Style%20Library/scripts/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://esites.mysite.com/sites/mysite/Style%20Library/scripts/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript" language="javascript">
  $(document).ready(function() {
    alert("jQuery");
    alert( $().SPServices.Version() );
   alert($().SPServices.SPGetCurrentSite());
  });
</script>
and I receive the first "jQuery" alert but not the other two alerts, and I cannot understand what I am doing wrong. The src reference is correct, as I have copied and pasted the link from the style library into the script. We are using SharePoint 2013.

Can you help me understand what rookie mistake I may be making?

The script is located in a webpart on a "new" form. So as a user enters a "new" record into a list database, two of the fields are multi select fields from another list, and I need those two fields to be enlarged. I noticed the code to enlarge them was not working, in reading the documentation I am testing the references using the alert method (above) and the alerts are not working. Cannot figure out why they are not working as the referencing src lines are pretty straight forward.
Closed Jun 18, 2016 at 3:30 PM by sympmarc
Not an issue with SPServices itself.

comments

BensonJT wrote Aug 20, 2015 at 2:53 PM

So here was the solution to my problem - I had to add the jQuery.noConflict();

``` `<script type="text/javascript" src="https://esites.mysite.com/sites/mysite/Style%20Library/scripts/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://esites.mysite.com/sites/mysite/Style%20Library/scripts/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript" language="javascript"> $(document).ready(function() { alert("jQuery"); jQuery.noConflict(); alert( $().SPServices.Version() ); alert($().SPServices.SPGetCurrentSite()); }); </script>``

alfred_j_kwack wrote Jun 18, 2016 at 9:44 AM

This reminds me of something...
Would it not make sense to have SPServices support cases where jQuery.noConflict(true) is called:
(function($) {
$.fn.lazyPlugin = function(opt) { // ... }
})(jQuery || _jQuery);

sympmarc wrote Jun 18, 2016 at 3:30 PM

@alfred_j_kwack

As @ptavares notes in this thread, http://spservices.codeplex.com/discussions/227937#post1476669, SPServices should respect the .noConflict call.

M.