以下是我通过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>
答案 0 :(得分:1)
使用the doc
中的可用回调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");
}
答案 1 :(得分:1)
$(function () {
jQuery('#txtdatetime').datetimepicker({
startDate: '+1971/05/01',
format: 'd.m.Y H:i',
onChangeDateTime: function () {
//fire what you want
}
});
});