Reputation: 217
I am facing an issue where by i uses the following addon for jquery date
http://trentrichardson.com/examples/timepicker/
1) I am able to pick a date and time via his example 2) But I did a check and the system does not recognize the string on initial input, it will be undefined until you enter a space ' ' into the textbox.
any advise?
html example
<td>Start Time: <input id="startTimePicker" class="textBox" data-ng-model="StartTime" type="text"></input></td>
<td>End Time: <input id="endTimePicker" class="textBox" data-ng-model="EndTime" type="text"></input></td>
my script example
$(function() {
$("#startTimePicker").datetimepicker(
{
dateFormat: 'yy-mm-dd'
});
});
$(function() {
$("#endTimePicker").datetimepicker(
{
dateFormat: 'yy-mm-dd'
});
});
Upvotes: 0
Views: 83
Reputation: 5831
Think it's due to call multiple datetimepicker on multiple input.
Try to add a class in all your input where you want a datepicker.
And init them only one time.
Example
<input id="startTimePicker" class="textBox datetimepicker" data-ng-model="StartTime" type="text"></input>
Jquery :
$(document).ready(function(){
$(".datetimepicker").datetimepicker(
{
dateFormat: 'yy-mm-dd'
});
});
Make sure your input are generated before the datetimepicker()
function. Or you must call the function after they are inserted in the DOM.
Upvotes: 1