How to troubleshoot when the scripts does not work

In most cases where users have trouble getting my solutions to work, the problem is the script references. I will give a few examples here on how to troubleshoot these cases.

To copy the script from sourcecode provided in the article, hover over the script and click “view source”. Highlight, copy and paste in notepad. Save with the correct file extension like this:

  • Select “Save as” from the file menu and be sure to use the “.js” extention in the file name. Below the file name, you find a drop down where you can set the file type.
  • Select “All files”. If you don not do this the file will be saved as “fielname.js.txt”.

To check that the scripts are referred correctly, insert an alert in the CEWP like this:
<script type="text/javascript" src="/test/English/Javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
// Check that jQuery is loaded:

// Check that a specific function is loaded:

Both these alerts should give a dialog box with the text “function”. If you get “undefined”, the script reference are wrong.

Another thing:
In most cases the CEWP must be placed below the list for or list view for the code to work.


29 thoughts on “How to troubleshoot when the scripts does not work”

  1. Greetings,
    I am having some trouble getting the character count working on my site. I have tried the ‘checking script’ above and i get the following returned

    I am 100% pointing to the correct script location, is there anything else I could check?

  2. Hi Alex,
    I was using a customised form but have now reverted to using the default form since I was having trouble. I have inserted the copied code into the CEWP ‘above’ the form. Also I have changed every reference to FieldInternalName to my actual field internal name.
    Is this correct?

  3. Hi alex, I finally got it to work by moving it to the bottom and correcting my syntax so that I only changed the ‘Mymultiline’ to be my actual InternalFieldName, thanks again.

  4. I am having problems getting my count to work. It doesn’t work as I am typing in the description field. As I’m typing a description, the count remains at 100. Only when I click OK and go back into the form, then it shows me how many remaining characters.

    1. Hi,
      The solution you are referring to is designed for plain text fields only. From your description, i believe you are using it with a rich text field.

      Is this the case?


  5. Thanks! That solution worked great for me! I just changed my field to plain text. One other little thing, when I’m in edit mode, for some reason I’m getting the “Version:Published Status:Published and visible to all users” with Page, workflow and a Tools tab at the top of the window. Do you know why this may be happening? If I remove the Content webpart, it doesn’t show up.

  6. I have carefully followed the instructions for the new code (ChartUsingGoogleVisualizationAPI_v2.0.js) and I loaded the troubleshooting script you listed. I get “function” followed by “undefined.” Other than setting the link to the user profile and url, am I missing something I should be doing in the CEWP?

  7. Hi,

    My code in CEWP goes like this..


    My js files are in the correct folder.. Why doesn’t my alert show at all? and when should I expect it to show – the moment I apply the changes or when I close exit mode and reopen the EditForm page?
    I have tried placing the CEWP both at the top and below the editForm Page, get no response anywhere..

  8. Hi,

    My code in CEWP goes like this..



    My js files are in the correct folder.. Why doesn’t my alert show at all? and when should I expect it to show – the moment I apply the changes or when I close exit mode and reopen the EditForm page?
    I have tried placing the CEWP both at the top and below the editForm Page, get no response anywhere..

    1. Hi,
      If the


      does not give anything i would think you had some sort of syntax error in the script.

      Even if the jQuery library wasn’t loaded the alert should give you “undefined”.


  9. My count is showing as -1 hits, -1 I Likes. I created the Hit Counter list at the root of my site collection. I am wondering if the Hit Counter list needs to be added for each subsite? Or do I need to change a reference in the .js file. Please help, Thanks!

    1. Hi,
      The solution is supposed to find a list in the same site. You could fix this by adding a new parameter to the object in the function “spjs_addItem”. The parameter should be named listBaseUrl and the value should be the base url (site root) of the list. You must add this to both the call to “spjs_addItem” and the function itself.


  10. Morning Alexander,
    Thanks for this solution, I have it running on one of my views and it works wonderful. When I tried to replicate it to another view it’s not working at all. I ran your “alert” script and it shows undefined.

    As far as I can tell I’ve done exactly the same thing on both views, one works the other not so much. Anything I could be missing?

  11. I’m trying to add this code to my SharePoint On-Line site and I keep getting a GUID error for the list, view and base url…but I followed the instructions. Thoughts on what I’m doing wrong?

    1. Hi,
      Ensure the base url is correct. Go to the list (AllItems.aspx) – right click and view the source of the page. Search for “L_Menu_BaseURL” – this is the base url.


  12. Hey All,

    I am using this script with a calendar view. I get any alert in the script but nothing pops up on the hover. No line, no square, nada. Has anyone had this issue where the script has not worked? What did you do to fix it? Thanks.


  13. Hi – I get the jquery to run, looks like connections to list are working fine, no errors display. The CEWP is below the list (tried it both ways), confirmed the only field name is plain text (using ‘title’) – results are a blue box and if I roll mouse over I see forward/back controls. No browser errors. List items are eluding me. Have tried a few lists. What have I forgotten? The environment is 2010. Thanks.

  14. Thanks for creating this. I have it working with the new star voting but it’s not keeping count. I tried to give all authenticated user full control and I am a site admin but the count is not being tracked. Not sure what else I should look for? Thanks.

  15. Hi,

    Thanks for providing this useful information.

    I have successfully implemented this however I can see the “Like” and “Count” functions but when I click “Like”, it registers as a count but when I go back to the page, it resets back to 0.

    Please could you help me ascertain how to set it so that the count is saved.

    Also – the page Hits doesn’t work either. It just says 0.

    I am implementing this solution on a “Page” rather than a list.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.