从jQuery Datepicker获取今天的日期 [英] Get today's date from jquery datepicker

查看:353
本文介绍了从jQuery Datepicker获取今天的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将jquery datepicker中currentText属性的默认显示从今天"更改为今天:2012年9月14日".因此,问题是日期选择器是否通过某种方法公开了今天的日期?还是我必须创建自己的JS new Date()并从那里获取日期,所以我想避免这种情况!

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 datepicker expose today's date via some method? or do I have to create my own JS new Date() and get the date from there, which I am trying to avoid!

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

推荐答案

是的,currentText是您想要的.

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

演​​示

这篇关于从jQuery Datepicker获取今天的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆