我正在使用我的webapp上的TimePicker插件:http://trentrichardson.com/examples/timepicker/ 它工作得很好,除了“现在”按钮的默认行为不是我想要的。
对于普通的DatePicker,我发现这段代码很有效:
jQuery.datepicker._gotoToday = function ( id )
{
var target = jQuery( id );
var inst = this._getInst( target[0] );
if ( this._get( inst, 'gotoCurrent' ) && inst.currentDay )
{
inst.selectedDay = inst.currentDay;
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
inst.drawYear = inst.selectedYear = inst.currentYear;
}
else
{
var date = new Date();
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
this._setDateDatepicker( target, date );
this._selectDate( id, this._getDateDatepicker( target ) );
}
this._notifyChange( inst );
this._adjustDate( target );
};
不幸的是没有TimePicker。有人可以提供类似我可以用于TimePicker插件的代码吗?