无法使用时间选择器为输入字段找到正确的事件 [英] cant find the proper event for input field with timepicker
问题描述
我有一个带时间选择器的输入字段,我在UI
和引导日历中使用了具有此配置以用于时间选择器目的:
I have an input field with timepicker I used bootstrap calendar for my UI
and have this config for timepicker purpose:
<div class='input-append' id='datetimepicker2' >
<input data-format='HH:mm:ss PP' type='text' name="start_time" id="start_time" value="<?php echo set_value('start_time')?>"/>
<span class='add-on'>
<i data-date-icon='icon-calendar' data-time-icon='icon-time'>
</i>
</span>
</div>
</div>
<script type='text/javascript'>
$(function() {
$('#datetimepicker2').datetimepicker({
language: 'en',
pick12HourFormat: true,
pickDate: false
});
});
</script>
什么是即时工作的,如果我使用从start_time
到end_time
的时间选择器完成输入数据,我会自动计算total_time
,但是我不知道在哪里触发该事件.我不能使用onchange
,onblur
,因为焦点是 NOT 而不是输入字段,而是时间选择器图标.当我使用$('#datetimepicker2').click
或时间选择器中的任何事件时,它均不起作用,仅$('#datetimepicker2').datetimepicker
本身有效.那么,我将event
放在哪里或需要执行哪些特定事件?有什么帮助吗?因为我真的在这里呆了这么长时间
what im working is that if I'm done entering data using the timepicker from start_time
to end_time
I automatically calculate the total_time
but I dont know where to fire the event. I could'nt use onchange
,onblur
because the focus is NOT on the input field but on the timepicker icon. It's not working either when i use $('#datetimepicker2').click
or any event in the timepicker, just the $('#datetimepicker2').datetimepicker
itself works. So where do i put the event
or what specific event do i needed to do that? any help? coz i'm really stuck in here for so long
推荐答案
尝试使用changeDate事件.
Try using changeDate event.
$('#datetimepicker2').datepicker()
.on('changeDate', function(ev){
});
这篇关于无法使用时间选择器为输入字段找到正确的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!