1

I am using jquery ui dialog. I have initialized a dialog at document.ready event.

   $("#globalConfirm").dialog({
        width: 500, autoOpen: false, resizable: false, draggable: false,
        modal: false        
   });

This dialog is for confirmation. Now later i want to add a buttons options and there callback functions like :

   $("#globalConfirm").dialog("option", "buttons", '{
        "Confirm": function (event, ui) {
            //jquery code
        },
        "Cancle": function (event, ui) {
            $(this).dialog("close");
        }'
    );

Is this write way to initialize the buttons option of jquery ui dialog after initializing dialog ?

1 Answer 1

2

Yes, just pass the option as an object, not a string.

   $("#globalConfirm").dialog("option", "buttons", {
        "Confirm": function (event, ui) {
            //jQuery code
        },
        "Cancel": function (event, ui) {
            $(this).dialog("close");
        }
    );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.