Tuesday, August 5, 2014

How to get value of Start Time & End Time in Caledar New & Edit Page using JavaScript

Output of above JavaScript on above dispayed image www.technologykhabar.wordpress.com-FetchEventStartTimeDateHello Friends. Today my friend facing an issue in fetching event Start Time from the Calendar New Page. She ask me to help her for fetching Event Start Time. As all developers do I analyze the code generated from SharePoint and verify the HTML and find the solution as describe below:

She needs value from drop down of the Event Start Time in JS when user click on Save button. So she is worrying about how to fetch single dropdown value of the page in JavaScript.

Calendar Start Time Field

Suppose when user click on Save button at that time selected value is displayed in above display picture then how to get value is describe below:

1). Fetch Date from the Event Start Time

$("input[title='Start Time']").val()

It will give result as displayed in below image.

www.technologykhabar.wordpress.com-FetchEventStartTimeDate

 

 

2). Fetch Time (Hrs.) from the Event Start Time
$("#" + $("label:contains('Start Time Hours')").attr("for")).find('option:Selected').text()

It will give result as displayed in below image.

Output of above JavaScript on above dispayed image

3). Fetch Time (Minutes) from the Event Start Time

Fetch Event Start Time Minutes

It will give result as displayed in below image.

2 comments: