我可以使用以下命令创建一个jquery ui对话框:
$("#dialogs .add_entry").dialog
({
height: 500,
width: 750,
autoOpen: false,
stack: true,
show: "fade",
resizable: true,
title: "Add Entry",
modal: true
});
<div id="dialogs">
<div class="add_entry">Test</div>
</div>
但后来我使用$(“#dialogs .add_entry”)。dialog(“open”);打开对话框没有任何反应(没有js错误)。我认为它与选择器相关,将autoOpen切换为true显示对话框。有人遇到过这个吗?
答案 0 :(得分:0)
试试这个:
$("#dialogs > .add_entry")
OR
$("#dialogs").children(".add_entry")
答案 1 :(得分:0)
$(function(){
$element = $("#dialogs .add_entry");
$element.dialog({
height:500,
width:750,
stack: true,
show: "fade",
resizable: true,
title: "Add Entry",
autoOpen:false,
modal: true
});
$element.dialog("open");
});
如果放在元素之前,这是有效的。以后不起作用。也没有使用out变量,没有包装函数不起作用......什么是错误的功能。