I was making a project with a datepicker(JQuery) . When i click the date in the datepicker it never shows the date unless space or enter is typed. I want it that when I click the date, the date clicked is showed.
I expect the output to be automatically show the date when clicking the date in datepicker. But I have to press spacebar first before it generates/ show the date .. Please help .. These are my codes :
$(document).ready(function () {
$("#datepickerfrom").datepicker({
numberOfMonths: 1,
onSelect: function (selected) {
$("#datepickerto").datepicker("option", selected)
}
});
$("#datepickerto").datepicker({
numberOfMonths: 1,
onSelect: function (selected) {
$("#datepickerfrom").datepicker("option", selected)
}
});
// jQuery object; this demo
});
function GetbyDate(fr, t) {
var from = new Date(t)
};
scope.changeDate = function () {
scope.models = null;
http.get('GetReportList?from=' + scope.filter_fromDate + '&to=' + scope.filter_toDate).success(
function (data) {
scope.models = data;
});
}
<p class="input-group">
<input type="text" class="form-control" id="datepickerfrom" data-ng-model="filter_fromDate" />
<span class="input-group-btn">
<button type="button" class="btn btn-default">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
{{filter_fromDate}}
</p>
<p class="input-group">
<input type="text" class="form-control" id="datepickerto" data-ng-model="filter_toDate" />
<span class="input-group-btn">
<button type="button" class="btn btn-default">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
{{filter_toDate}}
</p>