Add a button to a dialog box dynamically

后端 未结 2 1194
猫巷女王i
猫巷女王i 2021-02-06 00:52

Is there any way to add a button to a dialog box in jquery ui dynamically.

I tried using: $(this).add(\"button\");

2条回答
  •  终归单人心
    2021-02-06 01:39

    Sometimes you want to add the buttons later too.

    var mydialog = ... result of jqueryui .dialog()
    var buttons = mydialog.dialog("option", "buttons"); // getter
    $.extend(buttons, { foo: function () { alert('foo'); } });
    mydialog.dialog("option", "buttons", buttons); // setter
    

提交回复
热议问题