【发布时间】:2014-08-08 14:12:09
【问题描述】:
我想要一个带有 javascript 函数的 Jquery 对话框,它显示成分列表(成分来自数据库,这就是我在 js 函数中使用它的原因)。我有这个按钮:
<div id="dialog">
//WANT showKeyIngredients() to show up in here, the dialog box
</div>
<div id="confirm-dialog">
<a href='#' class="buttonstyle2" onclick="showKeyIngredients();">
Browse
</a>
</div>
这是我的 jQuery:
$(function ()
{
$("#dialog").dialog({
autoOpen: false,
bgiframe: true,
autoOpen: false,
resizable: false,
minHeight: 250,
width: 700,
height: 250,
modal: true
});
$("#confirm-dialog").click(function ()
{
$("#dialog").dialog("open");
});
});
我很抱歉这可能很混乱,因为我是 jQuery 新手,并且一直只是复制和粘贴东西。我什至不确定这是否可能。我一直在到处研究,没有发现任何东西。我想要的只是显示在对话框中的 showKeyIngredient() 函数。 html中的onclick根本没有出现在对话框中。
我喜欢这里的对话框,但希望我的 showKeyIngredients() 函数显示在其中。并且有一个按钮可以弹出这个对话框。
【问题讨论】:
-
对话框只是另一个
div。如果要在其中插入信息,请在对话框 div 中选择适当的子元素并附加到该子元素。您需要显示其他代码,例如showKeyIngredients,以获得更好的答案。
标签: javascript jquery html jquery-ui dialog