我使用的是jquery 2.1和jquery-ui 1.8,我得到了[语法错误,无法识别的表达式:unsupported pseudo:ui-dialog]。使用旧版本的jquery时,Dialog工作正常但我需要在2.1版本中使用它。
代码:
$(document).find('body').append('<div id="dialog"></div>');
$("#dialog:ui-dialog").dialog("destroy");
$("#dialog").dialog({
modal: true,
bgiframe: true,
width: 470,
height: 330,
autoOpen: false,
title: 'Are you sure you want to exit?'
});
// LINK
$("a.confirm").click(function(link) {
link.preventDefault();
var theHREF = $(this).attr("href");
var theREL = $(this).attr("rel");
var theMESSAGE = (theREL == undefined || theREL == '') ? defaultMessage : theREL;
var theICON = '<span class="ui-icon ui-icon-alert" style="float:left;"></span>';
// set windows content
$('#dialog').html('<P>' + theICON + theMESSAGE + '</P>');
$("#dialog").dialog('option', 'buttons', {
"Logout MYCIC" : function() {
mycicExternalLinksProcessLogout(this);
var url = exit + theHREF;
alert(url);
window.open(url);
//alert("link is "+exit+theHREF);
},
"Cancel" : function() {
mycicExternalLinksProcessCancel(this);
},
"Continue" : function() {
mycicExternalLinksProcessContinue(this);
}
});
$("#dialog").dialog("open");
});