How to dynamically set bootstrap-datepicker's date value?
Solution 1:
This works for me
$(".datepicker").datepicker("update", new Date());
Solution 2:
var startDate = new Date();
$('#dpStartDate').data({date: startDate}).datepicker('update').children("input").val(startDate);
another way
$('#dpStartDate').data({date: '2012-08-08'});
$('#dpStartDate').datepicker('update');
$('#dpStartDate').datepicker().children('input').val('2012-08-08');
- set the calendar date on property data-date
- update (required)
- set the input value (remember the input is child of datepicker).
this way you are setting the date to '2012-08-08'