为什么第二个 jQuery-UI 对话框标题在弹出时不改变。第一个对话框我使用以下命令更改框的标题.attr("title", "Confirm")
-- 它将第一个框的标题更改为“确认”,就像它应该有的那样。现在,当第二个框弹出时,它应该将标题更改为“消息”,因为对第二个框做了同样的事情 -.attr("title", "Message")
。正确的?但事实并非如此。它保留了之前的标题。然而,消息发生了应有的变化。我已经在IE8、Chrome和FF3.6中进行了测试。
<div id="dialog-confirm" title=""></div>
JavaScript / jQuery
$('#userDelete').click(function() {
$(function() {
var dialogIcon = "<span class=\"ui-icon ui-icon-alert\"></span>";
var dialogMessage = dialogIcon + "Are you sure you want to delete?";
$("#dialog-confirm").attr("title", "Confirm").html(dialogMessage).dialog({
resizable: false,
height: 125,
width: 300,
modal: true,
buttons: {
'Delete': function() {
$(this).dialog('close');
$.post('user_ajax.php', {action: 'delete',
aId: $('[name=aId]').val()
}, function(data) {
if(data.success){
var dialogIcon = "<span class=\"ui-icon ui-icon-info\"></span>";
var dialogMessage = dialogIcon + data.message;
$('#dialog-confirm').attr("title", "Message");
$('#dialog-confirm').html(dialogMessage);
$('#dialog-confirm').dialog({
resizable: false,
height: 125,
width: 300,
modal: true,
buttons: {
'Okay': function() {
$(this).dialog('close');
var url = $_httpaddress + "admin/index.php"
$(location).attr('href',url);
} // End of Okay Button Function
} //--- End of Dialog Button Script
});//--- End of Dialog Function
} else {
$_messageConsole.slideDown();
$_messageConsole.html(data.message);
}
}, 'json');
}, //--- End of Delete Button Function
'Cancel': function() {
$(this).dialog('close');
} //--- End of Cancel Button Function
} //--- End of Dialog Button Script
}); //--- End of Dialog Script
}); //--- End of Dialog Function
return false;
});
如果您选择提供帮助,感谢您的帮助。