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.

How to hide fields based in selection of radio button using java script

SharePoint generates a HTML code for the New/Edit/Display Page for each created list.

Now you have to the following java script code in your desire page to hide the field

Assume the html code is as follow:

<input type="radio" name="Internal Person" id="Person Type" value="ctl001">Internal Person</input> 
<input type="radio" name="External Person" id="Person Type" value="ctl002" >Invoiced</input>
The above code displays 2 radio button. Now you want to hide
var newVal = $(':radio[name=Reported By]:checked').val();
if (newVal == "ctl001") 
{
       $('nobr:contains("Internal Reporter Name")').closest('tr').show(); 
       $('nobr:contains("External Reporter Name")').closest('tr').hide(); 
}
else
{
       $('nobr:contains("Internal Reporter Name")').closest('tr').hide(); 
       $('nobr:contains("External Reporter Name")').closest('tr').show();             
}