Dynamically changing jQueryUI dialog buttons

后端 未结 1 332
生来不讨喜
生来不讨喜 2020-12-11 10:01

Attempting to change multiple jQuery UI dialog() buttons on the fly.

The problem with below code is that only one button is displayed at the first instance of the di

相关标签:
1条回答
  • 2020-12-11 10:32

    I have tried to use the Object type for the buttons and it works :

    dlg.dialog(
        'option',
        'buttons', {
            "Download": function () {...},
            "Not now": function () {...}
        }
    );
    

    See updated jsFiddle

    Object: The keys are the button labels and the values are the callbacks for when the associated button is clicked.

    EDIT : But you had an error in your array, you must have an array of object and there were missing { and }.

    'buttons', [
        {
            text: "Download",
            click: function () {...}
        },
        {
            text: "Not now",
            click: function () {...}
        }
    ]
    

    See correction of your jsFiddle

    0 讨论(0)
提交回复
热议问题