从jquery datepicker获取今天的日期

Haz*_*ama 4 jquery jquery-ui jquery-ui-datepicker

我需要将currentTextjquery datepicker中的属性的默认显示从"Today"更改为"Today:Septmeber 14,2012".所以问题是日期选择器是通过某种方法公开今天的日期吗?或者我是否必须创建自己的JS新Date()并从那里获取日期,我试图避免!

$('#txtSelectedDate').datepicker({
        showButtonPanel: true,
        currentText: "Today: " + getTodaysDate(); // Is there such a method?
    });
Run Code Online (Sandbox Code Playgroud)

Mic*_*uda 8

是的,这currentText就是你要找的.

$('#txtSelectedDate').datepicker({
    showButtonPanel: true,
    currentText: "Today:" + $.datepicker.formatDate('MM dd, yy', new Date())  
});?
Run Code Online (Sandbox Code Playgroud)

DEMO