jQuery UI datepicker opens automatically within dialog

后端 未结 12 1706
面向向阳花
面向向阳花 2020-12-16 10:14

I have a datepicker which is used within the jQuery dialog object. The source of the dialog\'s content is loaded using .load(). Within the dialog I created a sc

12条回答
  •  旧时难觅i
    2020-12-16 10:46

    You might want to think about destroying the datepicker when the dialog is closed and creating it in the open event handler for the dialog instead of including it as a script in the dialog creation.

     $('#dialog').dialog({
         open: function(event, ui) {
            $(ui).find('#date').datepicker();
         },
         close: function(event,ui) {
            $(ui).find('#date').datepicker('destroy');
         }
     });
    

    You could also experiment with different events/methods to see if you really need to recreate it, but I think that this would work.

提交回复
热议问题