jQuery bootstrap-datetimepicker更改事件
问题描述:
我在我的项目中使用了Jonathan Peterson的 bootstrap-datetimepicker插件.
I am using bootstrap-datetimepicker plugin from Jonathan Peterson on my project.
我遇到更改事件的问题:
如果我定义这样的事件:
If I define event like this :
$('#Release').on('dp.change', function(e){ console.log(e.date()); })
我收到错误消息:
未捕获的TypeError:e.date不是函数
Uncaught TypeError: e.date is not a function
任何人都知道如何在变更事件上获取新的日期值吗?
Anyone knows how to get new date value on change event ?
答
看着该链接,您似乎很靠近.您需要删除括号以获取正确的值.当前尝试记录该值的方式使浏览器认为它需要调用函数.
Looking at that link, it appears you are very close. You need to remove the parenthesis to get the right value.The way you currently are trying to log the value makes the browser think it needs to call a function.
$('#Release').on('dp.change', function(e){ console.log(e.date); })