[英]cannot stop/remove/destroy datetimpicker function (jquery)
i have condition that need datetimepicker and stop datetimepicker function, my code: 我有需要datetimepicker和停止datetimepicker函数的条件,我的代码:
$('.berdasarkan').on('change', function(){
thisval = $(this).val();
if(thisval == 'klien'){
$('input[name="search"]').datetimepicker('remove');
console.log('1');
}else if(thisval == 'tanggal'){
$('input[name="search"]').datetimepicker({
format:'DD-MM-YYYY'
});
console.log('2');
}else if(thisval == ''){
console.log('3');
}
});
but datetimepicker still running when i choose first condition, is my code wrong ? 但是当我选择第一个条件时datetimepicker仍在运行,我的代码是否错误?
[SOLVED] [解决了]
I am using this code : 我正在使用此代码:
$('input[name="search"]').data('DateTimePicker').destroy();
如果需要删除datetimepicker,则只需删除正在使用的类“ berdasarkan”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.