繁体   English   中英

XDSoft DateTime Picker 的 jQuery 插件中的 Onchange 事件

[英]On Onchange Event In jQuery Plugins by XDSoft DateTime Picker

这是我在 XDSoft DateTime Picker 的 jQuery 插件中对 onchange 事件的编码

<input type="text" data-format="dd/MM/yyyy hh:mm:ss" class="form-control" id="txtdatetime">
<script type="text/javascript">
    $(function () {        
     jQuery('#txtdatetime').datetimepicker({
     startDate: '+1971/05/01',
     format: 'd.m.Y H:i',
     onChangeDateTime: function () {
     alert('yup');
     }
   });
 });
</script>

使用文档中的可用回调

onSelectDate: function () {},
onSelectTime: function () {},
onChangeMonth: function () {},
onChangeYear: function () {},
onChangeDateTime: function () {}, //the one you're after
onShow: function () {},
onClose: function () {},
onGenerate: function () {}

所以,你的代码变成:

$(function () {
    $('#txtdatetime').datetimepicker({
        startDate: '+1971/05/01',
        format: 'd.m.Y H:i',
        onChangeDateTime: myfunction
    });
});

function myfunction() {
    alert("yup");
}
 $(function () {

        jQuery('#txtdatetime').datetimepicker({
            startDate: '+1971/05/01',
            format: 'd.m.Y H:i',
            onChangeDateTime: function () {
               //fire what you want
           }
        });
    });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM