these are my first experience using javascript and page events in Sharepoint...

My issue: I want that when a user click on "+ADD" in a calendar view, the new form have to display "09.00" as Start Time and "15:00" as End Time.

Using JQuery(document).ready(function() I'm able to write both values but when sharepoint page ends up loading, the "End Time" is set to Start Time + 1 hour.

I've seen that I could use sharepoint functions as _spBodyOnLoadFunctionNames.push(MyFunction) or ExecuteOrDelayUntilBodyLoaded But they wont fire, (it is probably my mistake) My code is:

     function sharePointReady() {
     // set the Start Time
    jQuery("#ctl00_ctl40_g_0d0e6e1c_e441_4c2e_8ae3_9cc792097d37_ff31_ctl00_ctl00_DateTimeField_DateTimeFieldDateHours option:contains('09:')").attr('selected', 'selected');
    //Set the End Time
    jQuery("#ctl00_ctl40_g_0d0e6e1c_e441_4c2e_8ae3_9cc792097d37_ff41_ctl00_ctl00_DateTimeField_ctl00 option:contains('17:')").attr('selected', 'selected');

What is wrong? Thanks to everybody


  • I also have the same problem. The End time seems to be set to take the hour value of the Start Time and add an hour to it. This does not seem to be done from the Site Column configuration section, but rather in some kind of script that I cannot find. Did you end up solving the problem? Commented Sep 26, 2017 at 15:52

1 Answer 1


I've solved in this way: 1) I have hidden the End Time Textbox; 2) In the PreSaveItem() function I calculate the hours value (it's an inputbox filled by users) and add this value to the hidden End Time Texbox via Jquery

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.