Reputation:
How to set date for an inline Datepicker
in jqueryUI?
Upvotes: 13
Views: 83747
Reputation: 11
You can set multiple dates as well by using this:
allBookings = []
_.each(Session.get('thisGuide').bookings,function(e){
allBookings.push(moment(e).format('MM/DD/YYYY'))
})
$('#datepicker').datepicker('setDates',allBookings)
Upvotes: 1
Reputation: 318192
When initializing a datepicker, you'd use the defaultDate
option:
$("#date").datepicker({
defaultDate: '01/26/2014'
});
when changing the date later, you'd use setDate
method:
$("#date").datepicker();
// more code
$("#date").datepicker('setDate', '01/26/2014');
Upvotes: 43