Sometimes a lot of trouble with him. In the attribute, the value of the data is data data 06/28/2014, but the datepicker shows either today or nothing. I solved it this way:
<input type="text" class="form-control datepicker" data-value="<?= date('dm-Y', (!$event->date ? time() : $event->date)) ?>" value="<?= date('dm-Y', (!$event->date ? time() : $event->date)) ?>" />
I added a datapicker attribute data value to the input, because if jQuery (this) .val () OR OR jQuery (this) .attr ('value') is called, nothing works. I decided to run a loop in each datapicker and take its value from the attribute data value:
$("form .datepicker").each(function() { var time = jQuery(this).data('value'); time = time.split('-'); $(this).datepicker('setDate', new Date(time[2], time[1], time[0], 0, 0, 0)); });
and it works fine =)
realmag777 May 20 '14 at 19:24 2014-05-20 19:24
source share