jquery ui对话框不能打开两次

jquery ui对话框不能打开两次,jquery,jquery-ui-dialog,Jquery,Jquery Ui Dialog,我对jQueryUI对话框有问题。 一旦我关闭它,它就无法打开。这是我试过的 html: 请提供任何帮助:)删除 $(this).remove(); 来自关闭前事件。您写这行的目的是什么 e.preventDefault(); $(this).remove(); 如果不需要,请删除并重试。删除下面的行,即关闭时从DOM中删除对话框 beforeClose: function(){ $(this).remove(); } 继续 $( '#videodialog' ).dialog

我对jQueryUI对话框有问题。 一旦我关闭它,它就无法打开。这是我试过的

html:

请提供任何帮助:)

删除

$(this).remove();

来自关闭前事件。

您写这行的目的是什么

 e.preventDefault();
 $(this).remove();

如果不需要,请删除并重试。

删除下面的行,即关闭时从DOM中删除对话框

beforeClose: function(){   $(this).remove();   }
继续

$( '#videodialog' ).dialog({
         autoOpen: false,
            height: 380,
            width: '50%',
            position:[285,140],
            modal:true,
            resizable: false,
            draggable: false,
            open: function() { $("#video").attr('src','http://www.youtube.com/embed/b16V25eNyJY'); }
            beforeClose: function(){   $("#video").attr('src','');   }
    });

但是,如果我不这样做,即使在我关闭对话框后,音频仍在播放。您需要删除iframe的src以停止播放视频,并在打开对话框时重新设置。
beforeClose: function(){   $(this).remove();   }
$( '#videodialog' ).dialog({
         autoOpen: false,
            height: 380,
            width: '50%',
            position:[285,140],
            modal:true,
            resizable: false,
            draggable: false,
            open: function() { $("#video").attr('src','http://www.youtube.com/embed/b16V25eNyJY'); }
            beforeClose: function(){   $("#video").attr('src','');   }
    });