如何获取 UI-Datepicker 月份更改事件

Posted

技术标签:

【中文标题】如何获取 UI-Datepicker 月份更改事件【英文标题】:How to get UI-Datepicker month change event 【发布时间】:2018-11-29 14:29:23 【问题描述】:

enter image description here

代码:

$(function() 
        $("#businessDatepicker").datepicker(
            changeMonth: true,
            changeYear: true,
        );
    );

如何获取月份和年份的变化事件?

【问题讨论】:

获取月份和年份更改事件是什么意思? Detect change to selected date with bootstrap-datepicker的可能重复 【参考方案1】:
$(function() 
        $("#businessDatepicker").datepicker(
            changeMonth: true,
            changeYear: true,
            onChangeMonthYear: function () 
                alert('y');
            
        );
    );

【讨论】:

虽然这段代码 sn-p 可以解决问题,但including an explanation 确实有助于提高帖子的质量。请记住,您是在为将来的读者回答问题,而这些人可能不知道您提出代码建议的原因。

以上是关于如何获取 UI-Datepicker 月份更改事件的主要内容,如果未能解决你的问题,请参考以下文章