Reputation: 8981
I try to implement a Time and a Datepicker. If I do it this way:
<script>
$(function() {
/*date_obj = new Date();
date_obj_hours = date_obj.getHours();
date_obj_mins = date_obj.getMinutes();
date_obj_time = " '"+date_obj_hours+":"+date_obj_mins+"'";*/
$.datepicker.setDefaults( $.datepicker.regional[ "no" ] );
$( "#datepicker" ).datepicker({dateFormat: $.datepicker.W3C}); // + date_obj_time
<!--$('#datepicker').datetimepicker();-->
});
</script>
The Datepicker works, but if I do it this way:
<script>
$(function() {
/*date_obj = new Date();
date_obj_hours = date_obj.getHours();
date_obj_mins = date_obj.getMinutes();
date_obj_time = " '"+date_obj_hours+":"+date_obj_mins+"'";*/
<!--$.datepicker.setDefaults( $.datepicker.regional[ "no" ] );-->
<!--$( "#datepicker" ).datepicker({dateFormat: $.datepicker.W3C}); // +date_obj_time-->
$('#datepicker').datetimepicker();
});
</script>
Nothing shows up in the textfield, when I click it. How can I do this? Thanks
For the record, I followed this: http://trentrichardson.com/examples/timepicker/
Upvotes: 0
Views: 274
Reputation: 4078
jQuery to php date time UI calendar
<link rel="stylesheet" media="all" type="text/css" href="css/ui-lightness/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" media="all" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<input type="text" name="example1" id="example1" value="" />
<input type="text" name="example1" id="example2" value="" />
<script>
$('#example1').datetimepicker();
$('#example2').datetimepicker();
</script>
You can get all css from jquery website
And here is the sample zip file i have http://www.woofiles.com/dl-294002-m4UvKkLO-testdate.rar
Upvotes: 1