[英]jquery ui dialog modal only opens once using class selector
$(".groomed").click(function() {
var modal = $(".dash-modal", this).dialog({
height:400,
width:800,
modal:true,
autoOpen: false,
Cancel: function() {
$(".dash-modal", this).dialog("destroy");
}
});
console.log(modal);
modal.dialog('open');
});
I have gone threw all of the stack overflows and they all deal with a id selector and I need this to work with a class selector. 我扔了所有的堆栈溢出,它们都处理一个id选择器,我需要它与类选择器一起工作。 Code is included above.
上面包含了代码。
The console logs the following for the first click: 控制台将以下内容记录为首次单击:
[div#ui-id-2.dash-modal info ui-dialog-content ui-widget-content, prevObject: e.fn.e.init[1], context: tr.groomed, selector: ".dash-modal", constructor: function, init: function…] [div#ui-id-2.dash-modal info ui-dialog-content ui-widget-content,prevObject:e.fn.e.init [1],上下文:tr.groomed,选择器:“ .dash-modal “,构造函数:函数,初始化函数:]
And this for the second: [prevObject: e.fn.e.init[1], context: tr.groomed, selector: ".dash-modal", constructor: function, init: function…] 这是第二个:[prevObject:e.fn.e.init [1],上下文:tr.groomed,选择器:“。dash-modal”,构造函数:function,init:function…]
So it looks like the entire functionality is being removed after the modal is closed, the api says to use destroy, I've tried that with both close: and cancel: 因此,在关闭模态后,似乎所有功能都被删除了,api表示要使用destroy,我已经尝试过使用close:和cancel:
Please help, thanks! 请帮忙,谢谢!
Cancel: function() {
$(".dash-modal", this).dialog("destroy");
}
by this you destroy the dialog box 以此破坏对话框
close dialog box to use according to your requirement 关闭对话框以根据您的要求使用
Cancel: function() {
$(".dash-modal", this).dialog("close");
}
reference dialog close and dialog destroy 参考对话框关闭和对话框销毁
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.