Re-initialize or destroy Bootstrap datepicker dynamically

前端 未结 5 1919
别跟我提以往
别跟我提以往 2021-02-05 06:19

Is there a way to destroy the Bootstrap datepicker dynamically updating its options like format, beforeShowDay, etc.? I know that the jQuery UI datepicker has a destroy method b

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 07:04

    $('.datepicker').datepicker('remove');
    

    Make sure you have your date picker object in DOM before removing it. Without removing you can hide the calendar and change the format of date and update it .

    $('.datepicker').datepicker('update');
    

提交回复
热议问题