我正在尝试使用JQuery dialog
,实际上我在这方面没有任何问题。现在我想用我的alert confirmation
替换为JQuery Dialog Confirmation
,问题是当我显示JQuery Dialog
时代码继续工作,并且不会等待JQuery Dialog
响应。我想这样做是创建一个模式,以等待JQuery dialog
结果,并继续执行代码。按下按钮如何等待JsDialog响应?
function start(title, message, messageButtons)
{
//messageButtons => contains the buttons with the function see bottom
if(confirm)
{
jQuery("body").append(
"<div id='message_box' title='" + title + "'>" +
"<p>" + message + "</p>" +
"</div>"
);
jQuery("#message_box").dialog({
autoOpen: false,
modal: true,
resize: "auto",
width: 400,
height: "auto",
resizable: false,
buttons: messageButtons,
closeOnEscape: true
});
}
else
{
console.log("No response");
}
}
留言按钮结构之后
功能触发:
var messageButtons = {};
messageButtons['OK'] = function()
{
confirm = true;
};
messageButtons[EALang['cancel']] = function()
{
confirm = false;
$('#message_box').dialog('close');
};
的JQuery Dialog
显示正常,但在浏览器控制台我的用户之前获得No response
选择一个答案从JQuery Dialog
。所以主要的问题是在出现JQuery Dialog
后停止js代码,等待用户选择,然后继续上面的代码。你如何看到我在按钮函数中设置了confirm
变量,当用户按下相应的按钮并且这个工作正常时调用这个函数。
还有另一种方法可以做到这一点吗? – Dillinger
请问一个更具体的问题。 –
什么不清楚? – Dillinger