jquery - HTML/JS Bootstrap Datetimepicker change format base on js event -
i working datetimepicker using bootstrap, okie me create datetimepicker difference format
startpicker = $('#datetimepickerstart').datetimepicker({ format: time_format, language: 'en' });
time_format valid string datetime format. but, question: there way change format after datetimepicker initialized. example. have radiobutton change format, once radiobutton clicked, need change format correctly. have tried:
$('#range_include_time_option .btn-small').click(function () { if ($(this).attr("value") == 'range_dateonly') { startpicker.format = 'yyy-mm-dd'; } else { startpicker.format = 'yyy-mm-dd hh:mm:ss'; } });
but datetimepicker still same initialized. have tried
if ($(this).attr("value") == 'range_dateonly') { $('#datetimepickerstart').datetimepicker({ format: 'yyyy-mm-dd', language: 'en' }); } else { $('#datetimepickerstart').datetimepicker({ format: 'yyyy-mm-dd hh:mm:ss', language: 'en' }); }
but doesn't work. please me, existing problem bootstrap datetimepicker or thing wrong in code
finally, have found sily solution, have droped datetimepicker , create newone, remain id of text box reference later. btq, said, solution stupid, appreciated better solution.
Comments
Post a Comment