如何在jquery对话框中将"X"按钮更改为"Close" [英] How to change the 'X' button in a jquery dialog box to read 'Close'

查看:101
本文介绍了如何在jquery对话框中将"X"按钮更改为"Close"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MVC剃刀视图中有一个jquery对话框,其中有一个关闭按钮.但是在单击关闭按钮时,该对话框只是被隐藏未被删除,因此,当单击页面上的任何链接时,该对话框将不起作用,这是不希望的.否,我想在每次关闭对话框时都重定向到我的操作方法.

单击对话框标题上的"X"按钮后,我得到的正是我想要的.因此,我的上级现在要我完全删除关闭"按钮,并在标题中写上关闭"而不是"X".我设法通过chrome浏览器控制台编辑对话框,删除了对话框标题使用的大量CSS类.
但是我无法弄清楚在哪里更改代码(CSS或jquery)以实现此目标!请给我有关对话框的启发!


这是我的对话框:

I had a jquery dialog box in an MVC razor-view with a close button inside it. But on clicking the close button, the dialog just got hidden and not removed, so that when a click on any link on the page it doesnt work, which is not desired; noe do i want to redirect to my action method every time i close the dialog.

On clicking the ''X'' button on the dialog-header, i get exactly what i want. So my senior now wants me to completely remove the ''Close'' button and write "close" instead of ''X'' in the header. I managed to do it editing my dialogbox thru my chrome browser console, on removing a whole lot of CSS class that the dialog-header uses.
But i cannot figure out fwhere to change the code(CSS or jquery) in my project in order to make this happen!! Please enlighten me about dialogboxes!!


here is my dialogbox:

$(function () {

            $.ajaxSetup({ cache: false });
            $(".ExportStatus").live("click", function (e) {

                e.preventDefault();
                var height = 350, width = 370;  //height = 350 width = 345;
                $('<div><span class="well"  style="position: absolute; top: 85px; left: 70px"><img src="' + loaderimagePath + '" alt="Processing your request. Please wait..." /></span></div>')
                .addClass("dialog")
                .attr("id", $(this).attr("data-dialog-id"))
                .appendTo("body")
                .dialog({
                    title: $(this).attr("data-dialog-title"),                  
                    closeOnEscape: true,
                    resizable: false,
      //              close: $(this).attr("data-dialog-titlebar-close"),         
                    buttons: {
                        "Close": function () {
                            e.preventDefault();
                            $(".ui-dialog").remove();
                            $(".ui-widget-overlay").remove();
                        }
                    },
                    modal: true,
                    position: 'middle',
                    width: width,
                    height: height
                })              
                .load(this.href, function (response, status, xhr) {
                    if (status == "error") {
                        var msg = "Sorry but there was an error: ";
                        $('.dialog').html(msg + xhr.status + "<br/>" + xhr.statusText + "<br/>" + xhr.responseText);
                    }
                });
            });


推荐答案

(function(){
(function () {


.ajaxSetup({cache: false });
.ajaxSetup({ cache: false });


(" " ,功能( e){ e.preventDefault(); var 高度= 350 ,宽度= 370 ; // 高度= 350宽度= 345;
(".ExportStatus").live("click", function (e) { e.preventDefault(); var height = 350, width = 370; //height = 350 width = 345;


这篇关于如何在jquery对话框中将"X"按钮更改为"Close"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆