Bootstrap datetimepicker “dp.change” 时间/日期 选择事件


$('#<!--{$inputId}-->').datetimepicker({
  todayHighlight: true,
  format: "YYYY-MM-DD<!--{if $isTime}--> HH:mm<!--{/if}-->",
  pickTime: <!--{if $isTime}-->true<!--{else}-->false<!--{/if}-->,
  minuteStepping: <!--{$minuteStepping}-->,
  language: 'zh-CN',
  inputMask: true,
  inline: true,
  sideBySide: true,
  pickerPosition:'bottom-right'
}).bind('dp.change', function(e) {
  var d = new Date(e.date);

  console.log(d.getFullYear()); // 年
  console.log(d.getMonth() + 1); // 月
  console.log(d.getDate()); // 日期

}).next().on(ace.click_event, function(){
  $(this).prev().focus();
});

 

 

参考:

http://stackoverflow.com/questions/39247347/bootstrap-datetimepicker-dp-change


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM