firstly myself new to java script as well as jquery.i am having a task to be done i.e in google maps when we click on an specific area(polygon,circle) a infowindow needs to be opened with some styles.So i moved to infobox and added some css(jquery custom css ui lightness).in that infobox i need to show calender with time.so i done a lot of RD and writen code
i writen the code by using drawing tools,infobox,jquery custom css,jquery-ui-timepicker
Now my problem is jquery-ui-timepicker is not raising in infobox. if i am using it with in a normal div its working fine.
here is some of my code:
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/smoothness/jquery-ui.css" type="text/css" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.datetimepicker').datetimepicker({});
});
</script>
var contentString =
'<table width="100%"' +
'<tr>' + '<td width="18%">From Date:</input></td>' + '<td> <input class="datetimepicker" id="start_time" name="start_time" type="text" /></td>' + '<td width="18%" align="center">To Date:</input></td>' + '<td><input class="datetimepicker" id="end_time" name="end_time" type="text" /></td>' + '</tr>' +
'</table>'
function RaiseInfoWindow() {
google.maps.event.addListener(drawingModesType, 'click', function (event) {
if (infoBox)
infoBox.close();
var bounds = new google.maps.LatLngBounds();
message = GetMessage(drawingModesType);
InfoBoxType(InfoBox, message);
infoBox.setOptions({ content: message });
infoBox.setPosition(bounds.getCenter());
infoBox.open(map);
google.maps.event.addListener(infoBox, 'domready', function () {
jQuery("#tabs").tabs();
});
});
function GetMessage(polygon) {
coordinates = polygon.getPath().getArray();
message = ['<div id="tabs">', '<ul>', '<li><a href="#tab-1" ><span>Modify</span></a></li>', '<li><a href="#tab-2"><span>Save</span></a></li>', '</ul>',
'<div id="tab-1">', '<li><div style="color:#000" class="divText" >Approximately area is ' + GetAreaInAcres(polygon) + ' kms</div></li>', '<div class="divbuttonText"><p><input type="button" value="Edit" title="Edit" class="buttonStyle" onclick="ShapeEditable(true);" />' + " " + '<input type="button" value="Done" title="Done" class="buttonStyle" onclick="ShapeEditable(false);" />' + " " + '<input type="button" value="Delete" title="Delete" class="buttonStyle" onclick="DeleteShape(drawingModesType);" /></p></div>', '</div>',
'<div id="tab-2">', '<p>' + contentString + '</p>', '</div>', '</div>'].join('');
return message;
}
Update
JsFiddle Here Is my Jsfiddle with my complete code(dont think that i got mad. i tried to add the script url but its not working.i saw so many jsfiddles( which are given examples with jquery-ui-timepicker addon .js,there also same problem)so i added the script.my code starts from 2199 line.please neglect the before lines)
Update2:
here is my updated fiddle after applying the @gaurrav suggestion time picker is raising but it is raising after 2 to 3 clicks
The InfoBox is created dyanamically when the map loads, so '$(".datetimepicker")' won't be able to find your div. Try using '$("body").find(".datetimepicker")'.