Reputation: 20874
I have a jQuery datepicker and I cannot figure out how to programmatically change the month back to the current month. After making a POST
request to save the user's dates I need to return the calendar back to the current month. The calendar may be on a different month from the user playing around with different dates. I have tried setting the mindate
again but that did not work.
This is not a popup calendar.
Upvotes: 4
Views: 11336
Reputation: 1157
You can also use .val()
to set the date
$("#datepicker").val(date);
Upvotes: 0
Reputation: 318182
Setting the datepicker back to today
$('#myDatePicker').datepicker('setDate', new Date());
setting just the month back
var date = $('#myDatePicker').datepicker('getDate');
date.setMonth( (new Date()).getMonth() );
$('#myDatePicker').datepicker('setDate', date);
Upvotes: 13