Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 help me out.
Posted

1 solution

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
 
Share this answer
 
v3
Comments
Saroj Kumar Sahu 18-Jun-13 5:28am    
hi,thnks for ur reply...i have already gone through this.my requirement is while loading the popup i need to disable that button.
RelicV 18-Jun-13 5:57am    
Please check the updated answer.
Saroj Kumar Sahu 19-Jun-13 8:45am    
thnks..its working..but i have one problem..when the button is disable its click event is firing for me but in ur example not..how ?plz help me
RelicV 19-Jun-13 8:46am    
You'r welcome. Happy coding..! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900