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:
jQuery(document).ready(function(){
_spBodyOnLoadFunctionNames.push("sharePointReady");
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
Marco