I am using bootstrap datepicker along with a highchart string.
I want the datepicker date updated when the chart has been enlarged. When this event fires, I update the datepicker parameter values. The values ββare updated fine, but when a click is clicked, the date in the pop-up calendar is still old.
Here is my datpicker:
<div class="input-append date pull-right" id="dpStartDate" data-date="@DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy")" data-date-format="dd/mm/yyyy"> <input class="span2" id="startDateText" size="16" type="text" value="@DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy")" readonly=""> <span class="add-on"><i class="icon-th"></i></span> </div>
I tried just updating the values ββwith this code:
$('#dpStartDate').attr('data-date', startDate); $('#startDateText').attr('value', startDate);
which updates dates but does not set a calendar.
I also tried to fire the onChange event, which also updates the dates, but not the calendar:
$('#dpStartDate').trigger('changeDate', startDate); $('#dpStartDate').datepicker() .on('show', function (ev) { ev.stopPropagation(); }) .on('changeDate', function (ev, date) { var startDate = new Date(); if (date != undefined) { startDate = date; $('#dpStartDate').attr('data-date', startDate); $('#startDateText').attr('value', startDate); } else { startDate = ev.date; $('#dpStartDate').attr(startDate.getDate() + '/' + (startDate.getMonth() + 1) + '/' + startDate.getFullYear()); $('#startDateText').attr(startDate.getDate() + '/' + (startDate.getMonth() + 1) + '/' + startDate.getFullYear()); } $('#dpStartDate').datepicker('hide'); ev.stopPropagation(); });
Does anyone know if it is even possible to update this calendar?
thank
jquery twitter-bootstrap datepicker
corina mcintosh Jul 16 2018-12-12T00: 00Z
source share