javascript 如何捕捉datePicker关闭事件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19184453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to catch the datePicker close event
提问by SebC
I am using the date picker and it is working fine. Few of my web page need some calculation using the start and end date. I would like to be able to do the calculation when the datepicker close.
我正在使用日期选择器,它工作正常。我的网页很少需要使用开始和结束日期进行计算。我希望能够在日期选择器关闭时进行计算。
I am using:
我在用:
< input class="datePicker" id="endDate" name="endDate" type="text" value="04/10/2013 23:00" />
< input class="datePicker" id="endDate" name="endDate" type="text" value="04/10/2013 23:00" />
Anybody have any suggestions?
有人有什么建议吗?
回答by Anand
回答by Sarower Jahan
Simple. Just add your function into onClose
event. Sample code is below.
简单的。只需将您的功能添加到onClose
事件中即可。示例代码如下。
.datepicker({
defaultDate: "+1w",
changeMonth: true,
changeYear: true,
numberOfMonths: 1,
onClose: function () {
alert('Datepicker Closed');
}
});