jQuery UI datepicker opens automatically within dialog

后端 未结 12 1704
面向向阳花
面向向阳花 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条回答
  •  我在风中等你
    2020-12-16 11:04

    I had this exact problem and solved it with only a slight variation on tvanfosson's technique. For some reason I had to manually attach the "click" event to the datepicker field as below.

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

    (Sorry--I would've preferred to post this as a comment to tvanfosson's post but don't have the requisite rep.)

提交回复
热议问题