I am using a j query date and time picker and cannot seem to display the selected data never mind save to a db. I am using php with mysql and am not sure how to get the information. this is the j query date and time picker and the suggested j query to get the date from the picker:
<script type="text/javascript">
$(function(){
$('#date_picker').dtpicker();
});
</script>
<script>
PickerHandler.prototype.getDate = function(){
var $picker = this.$pickerObject;
var $input = this.$inputObject;
return getPickedDate($picker);
};
</script>
and my html
<div class="section section-breadcrumbs">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Book An Appointment</h1>
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<center><div id="date_picker">
</div>
<script type="text/javascript">
$(function(){
$('#date_picker').dtpicker(); });
</script>
<p>Date: <input type="text" id="date_picker"></p>
I firstly want to display the returned value to make sure its working before I try and input to db but i cant even get this to work. Any ideas?
here is a couple of examples for the jquery datetime picker . datepicker1 datepicker2
If you are using jquery datepicker you can load it using the following: First load necessary javascript and css files for datepicker and then call the datepicker function on the element. (Make sure you include latest jquery)
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
Here is a better view of the current code:
<div class="section section-breadcrumbs">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Book An Appointment</h1>
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<center><div id="date_picker"></div>
<script type="text/javascript">
$(function(){
$('#date_picker').dtpicker();
});
</script>
<p>Date: <input type="text" id="date_picker"></p>
</div></center>
</div>
</div>