如何更改jquery对话框中的“X”按钮以读取“关闭”

我在MVC剃刀视图中有一个jquery对话框,里面有一个关闭按钮。 但是在单击关闭按钮时,对话框刚刚被隐藏未被删除 ,因此当单击页面上的任何链接时它不起作用,这是不可取的; 我每次关闭对话框时都想重定向到我的动作方法。

单击对话框标题上的“X”按钮,我得到了我想要的。 所以我的大四现在要我完全删除’关闭’按钮并在标题中写“关闭”而不是“X”。 我设法通过我的Chrome浏览器控制台编辑我的对话框,删除了对话框标题使用的大量CSS类 。 但我无法弄清楚在我的项目中改变代码(CSS或jquery)以实现这一目标! 关于对话框请赐教!

这是我的对话框:

$(function () { $.ajaxSetup({ cache: false }); $(".ExportStatus").live("click", function (e) { e.preventDefault(); var height = 350, width = 370; //height = 350 width = 345; $('
Processing your request. Please wait...
') .addClass("dialog") .attr("id", $(this).attr("data-dialog-id")) .appendTo("body") .dialog({ // open: function () { // $(".ui-dialog-titlebar-close").val() = closebutton; // }, title: $(this).attr("data-dialog-title"), closeOnEscape: true, resizable: false, // close: $(this).attr("data-dialog-titlebar-close"), // $("data-dialog-title-close").live("click", // function () { // $(".ui-dialog").hide(); // $(".ui-widget-overlay").hide(); // }, //window.setTimeout('location.reload()', 0); $(this).remove() buttons: { "Close": function () { e.preventDefault(); $(".ui-dialog").remove(); $(".ui-widget-overlay").remove(); // $(" #quickfillDialog").dialog("hide"); return false; } },![enter image description here][1] modal: true, position: 'middle', width: width, height: height }) // $(".ui-dialog-titlebar-close").click( function() { // $(this).parent().children().children("a.ui-dialog-titlebar-close").remove(); .load(this.href, function (response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error: "; $('.dialog').html(msg + xhr.status + "
" + xhr.statusText + "
" + xhr.responseText); } }); });

您可以将上面jQuery代码的对话框部分修改为:

 .dialog({ open: function(event, ui) { $('.ui-dialog-titlebar-close') .removeClass("ui-dialog-titlebar-close") .html('Close'); } }) 

希望这可以帮助!