Get today's date from jquery datepicker

前端 未结 3 644
面向向阳花
面向向阳花 2021-01-13 06:03

I need to change the default display of currentText property in jquery datepicker from \"Today\" to \"Today: Septmeber 14, 2012\". So the question is does the d

相关标签:
3条回答
  • 2021-01-13 06:48

    Yes, the currentText is what you are looking for.

    $('#txtSelectedDate').datepicker({
        showButtonPanel: true,
        currentText: "Today:" + $.datepicker.formatDate('MM dd, yy', new Date())  
    });​
    

    DEMO

    0 讨论(0)
  • 2021-01-13 07:00

    If you need to initialize the datepicker with current date, you could use:

    $(".selector").datepicker( "option", "gotoCurrent", true );
    

    And of course you have the dateFormat which take a format defined here

    0 讨论(0)
  • 2021-01-13 07:09

    If you need to initialize the datepicker with current date, you could use:

     $(".selector").datepicker( "option", "gotoCurrent", true );
    
    0 讨论(0)
提交回复
热议问题