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

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

How to set date for an inline Datepicker in jqueryUI?

2条回答
  •  说谎
    说谎 (楼主)
    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

提交回复
热议问题