我使用的是datepicker表单jQuery-ui-1.8.16。在jquery-ui datapicker的'Today'按钮上添加事件监听器
我有以下代码:
Site.Calendar = function() {
// Set default setting for all calendars
jQuery.datepicker.setDefaults({
showOn : 'both',
buttonImageOnly : true,
buttonText: '',
changeMonth : true,
changeYear : true,
showOtherMonths : true,
selectOtherMonths : true,
showButtonPanel : true,
dateFormat : "D, d M, yy",
showAnim : "slideDown",
onSelect: Site.Calendar.customiseTodayButton
});
};
Site.Calendar.customiseTodayButton = function(dateText, inst) {
console.log("hello");
};
我customiseTodayButton功能时,我选择一个实际日期,而不是在今天按钮才刚刚启动。
有没有什么办法可以重写今日按钮在jQuery datepicker中的工作方式?
谢谢
谢谢马克。我想让“今日”按钮的行为与日期按钮相同,即选择“今日”按钮将输入字段更新为今天的日期并关闭日历。我应该能够根据你的反应找出它:) – 2012-01-05 17:11:03
所以这段代码不能正常工作,我忘记了datepicker实际上并没有像ui组件的其余部分那样使用ui widget类。现在更新答案,并准确添加您要查找的内容。 – PriorityMark 2012-01-05 19:10:28
非常好,非常感谢百万马克 – 2012-01-05 23:03:13