javascript - cannot stop/remove/destroy datetimpicker function (jquery) -
i have condition need datetimepicker , stop datetimepicker function, code:
$('.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 choose first condition, code wrong ?
[solved]
i using code :
$('input[name="search"]').data('datetimepicker').destroy();
if need remove datetimepicker, need remove class "berdasarkan" using.
Comments
Post a Comment