user2144270
user2144270

Reputation:

How to set date for an inline Datepicker in jquery UI?

How to set date for an inline Datepicker in jqueryUI?

Upvotes: 13

Views: 83747

Answers (2)

Harry Ward
Harry Ward

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

adeneo
adeneo

Reputation: 318192

When initializing a datepicker, you'd use the defaultDate option:

$("#date").datepicker({
    defaultDate: '01/26/2014'
});

FIDDLE

when changing the date later, you'd use setDate method:

$("#date").datepicker();
  // more code
$("#date").datepicker('setDate', '01/26/2014');

FIDDLE

Upvotes: 43

Related Questions