选择事件上的Bootstrap Datetimepicker [英] Bootstrap Datetimepicker on select event

查看:166
本文介绍了选择事件上的Bootstrap Datetimepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在选择日期时访问js函数exampleFunction()?我想在那里传递日期值。

How do I access a js function exampleFunction() when date is selected? I want to pass the date value there.

text_field_tag for datetimepicker(haml):

text_field_tag for datetimepicker (haml):

= text_field_tag 'start_day', class: 'datepick'

Javascript:

Javascript:

$(".datepick").datetimepicker({
  timepicker: false,
  format: 'd/m/Y',
  closeOnDateSelect: true
});


推荐答案

如果这是你正在使用的插件那么它会就像这样。

If this is the plugin you are using then it would be Like this.

$(".datepick").datetimepicker({
  onChangeDateTime:exampleFunction
});
function exampleFunction(){
  console.log("Date Selected")
}

完整选项列表参考:
http://xdsoft.net/jqplugins/ datetimepicker /

希望有所帮助。

这篇关于选择事件上的Bootstrap Datetimepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆