我需要我的日曆去當天的日期[今天]按鈕被點擊,以便用戶可以在瀏覽我的日曆時到達當天。jquery ui datepicker去今天按鈕
例如當前月份是2013年2月 和用戶正在瀏覽的2015年12月頁日曆,當他點擊[日]按鈕,它會自動返回到當前天頁面日曆是 feb 2013。
使用我'
的jQuery-UI-datepicker.min.js
爲我的日曆插件
我需要我的日曆去當天的日期[今天]按鈕被點擊,以便用戶可以在瀏覽我的日曆時到達當天。jquery ui datepicker去今天按鈕
例如當前月份是2013年2月 和用戶正在瀏覽的2015年12月頁日曆,當他點擊[日]按鈕,它會自動返回到當前天頁面日曆是 feb 2013。
使用我'
的jQuery-UI-datepicker.min.js
爲我的日曆插件
你可以這樣做:
function TodaysDate() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
return month + "/" + day + "/" + year;
}
$("#btnToday").click(function() {
var today = new Date();
$(target).datepicker('setDate', TodaysDate());
}
其中target
是您的日期選擇器控件ID。
jQuery UI Datepicker具有內置於其中的功能。
看到這個:http://jqueryui.com/datepicker/#buttonbar
$(function() {
$("#datepicker").datepicker({
showButtonPanel: true
});
});
大,做的伎倆 – telexper 2013-02-15 08:34:51