我正在尝试显示一个对话框,但当我单击“确定”按钮时无法将其关闭。我不确定..我做错了什么,你能告诉我吗?
当我尝试将此代码放入 jsfiddle 时,它没有显示任何输出:(
function alert_popup_msg(_msg)
{
var id = "dialog_" + (new Date()).getTime();
var popDiv = "<div id='" + id + "'><div class=\"popup-background\"><label class=\"color-white no-text-shadow center-align font-helv-16-bold std-padding-a\">Alert</label><label class=\"color-white no-text-shadow center-align font-helv-12-reg std-padding-a\">"+_msg+"</label><div class=\"center-align\"><a class=\"btn-simple-black-orange btn-text btn-login\" id=\"okButtonCallBack\">Ok</a></div></div></div> ";
$.mobile.activePage.append(popDiv).trigger("pagecreate");
//addEventListener_(id);
$( "#" + id ).dialog({
modal: true,
});
//$("#" + id).popup();
$("#" + id).dialog("open");
$("#okButtonCallBack").click(function(event){
$("#" + id).dialog("close");
});
};