如何从函数或模态对话框加载中禁用jQuery模式对话框中的按钮? [英] How can I disable a button in a jQuery modal dialog from a function or at modal dialog load?

查看:73
本文介绍了如何从函数或模态对话框加载中禁用jQuery模式对话框中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是JQuery的新手。我有一个jQuery对话框。在这种形式中,我有一个保存按钮。我希望在打开模态对话框时禁用此保存按钮。



我在下面给出了创建此按钮的代码。但是,我不知道如何从函数或加载对话框时启用和禁用对话框按钮。我该怎么办?

Hi,
I'm new to JQuery.I have a jQuery dialog. In this form, I have a "Save" button. I would like this "Save" button to be disabled while the modal dialog open.

The code i wrote to create this button is given below. However, I don't know how to enable and disable the dialog button from a function or at the time of loading the dialog. What should I do?

$('#divAddExpense').dialog({
                modal: true,
                autoOpen: false,
                height: 'auto',
                width: 650,
                draggable: true,
                position: 'center',
                resizable: false,
                buttons: { "Close": function () { $(this).dialog('close'); },
                        "Save": function (evt) {
                //Save click code here
                },
                close: function () {                    
                    //some code                   
                }
            });





Plz帮帮我。



Plz help me out.

推荐答案

('#divAddExpense')。dialog({
modal:true,
autoOpen:false,
身高:'自动',
宽度:650,
draggable:true,
position:'center',
resizable:false,
buttons:{Close:function(){
('#divAddExpense').dialog({ modal: true, autoOpen: false, height: 'auto', width: 650, draggable: true, position: 'center', resizable: false, buttons: { "Close": function () {


(this ).dialog( '关闭'); },
保存:function(evt){
//在这里保存点击代码
},
关闭:function(){
//一些代码
}
});
(this).dialog('close'); }, "Save": function (evt) { //Save click code here }, close: function () { //some code } });





Plz帮帮我。



Plz help me out.


嗨Saroj,



只需看看这个更新的JSFiddle [ ^ ]链接。它有一个复选框来启用或禁用保存按钮。



我们有一个 load 属性,我们可以在jQuery UI中使用它对话。在加载对话框弹出窗口时,我们可以禁用确认按钮。我已根据您的要求修改了代码。请仔细研究一下。



希望它可以帮到你。



谢谢,

RelicV
Hi Saroj,

Just take a look at this Updated JSFiddle[^] link. It has a checkbox to enable or disable the Save Button.

We have a load property which we can make use of it in jQuery UI Dialog. While loading the dialog popup, we can disable the Confirm button. I've modified the code as per your requirements. Please look into that once.

Hope it helps you.

Thank you,
RelicV


这篇关于如何从函数或模态对话框加载中禁用jQuery模式对话框中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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