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

前端 未结 2 582
别那么骄傲
别那么骄傲 2021-01-04 12:36

How to set date for an inline Datepicker in jqueryUI?

相关标签:
2条回答
  • 2021-01-04 13:21

    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)
    
    0 讨论(0)
  • 2021-01-04 13:30

    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

    0 讨论(0)
提交回复
热议问题