I have calendar webpart with list of leave and I need to calculate leave time under the table. Under calendar table I put script editor webpart with table:

<table id="Total">

Then I put Jquery code:

<script src="http://XXX/siteassets/java/jquery-3.1.1.min.js"></script><script type="text/javascript">
var totals = [];
$('#\\{A7F3A569-11ED-4EEC-B9CE-5626CFDA8427\\}-\\{750A17C0-4BF2-48B8-8FCA-749DDBCF5D87\\} tbody tr').each(function(e) {      
var tds= $(this).find('td');
var index = $(tds[1]).text();
var Numberofhord = parseFloat($(tds[2]).text().replace(",","."), 10);
if (totals[index] == undefined)
totals[index] = { Numberofhord: 0 };
totals[index].Numberofhord += Numberofhord;
for (var key in totals)
$('#Total tbody').append('<tr><td>'+key+'</td><td>'+totals[key].Numberofhord+'</td></tr>')

All works great on jsfiddle http://jsfiddle.net/qha5jr3b/ but dont work on my site.

I have SharePoint Foundation 2013. I put jquery-3.1.1.min.js to siteassets folder. I have tried to put script in js file and attach link to calendar webpart (link), also tried to use:

$(document).ready(function () 


$(window).bind("load", function()

Still nothing, jquery work only when I put static html table on script editor webpart or when I edit calendar webpart.

Any idea why my JQuery code is not working? Thank You!

  • check Console, if any errors are showing
    – Gaurravs
    Jan 3, 2017 at 12:11
  • If you say it works in Edit-Mode and not in Display mode then double double check and then check again if that hardcoded GUID actually exists in Display mode Jan 3, 2017 at 12:17
  • It works but only sometimes when i start to edit page, then start to change some properties of calendar webpart. Sript works great when I put static table with ID of webpart.
    – Chris
    Jan 3, 2017 at 13:32
  • What do you mean with "It works but only sometimes"? Only on page load and not when adding/editing items?
    – Cecilia
    Jan 3, 2017 at 13:34
  • It works only when I editing page next I change calendar webpart properties. Cosole show ony two alerts - DOM7011 disable back navigation caching SEC7115 :visited and :link styles can only differ by color
    – Chris
    Jan 3, 2017 at 14:00

2 Answers 2


After hours I found problem, I pasted script like this:

<script src="http://xxx/siteassets/java/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="http://xxx/siteassets/java/su.js></script>

After change to:

<script type="text/javascript" src="http://xxx/siteassets/java/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="http://xxx/siteassets/java/su.js></script>

All works! Thank you anyways!


Open the source code of your site SharePoint, and locate the script tag, then try to open the script link in a new window, normally the script should be displayed (like this one), otherwise fix the link in the script tag.

Another thing, make sure the browser does not block JavaScript scripts

Keep me informed

  • Im using IE and chrome. I have no option in IE to open in new tab but in chrome when I click open in new tab its downloading js file from server.
    – Chris
    Jan 3, 2017 at 13:26

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.