jQuery UI dialog button text as a variable

后端 未结 12 1797
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 01:21

Can anyone tell me how can i use a variable for button text in jQuery UI dialog? I want to make a dynamic button name.

12条回答
  •  眼角桃花
    2020-12-13 02:15

    Maybe I'm missing the point - but wouldn't the easiest way be to use the setter?

         $("#dialog_box").dialog({
            buttons: {
             [
                text:"OK",
                click: function() {
                    //... configure the button's function
                }
             ]
            });
    
            $("#dialog_box").dialog("option", "buttons", { "Close": function() { $(this).dialog("close"); } });
    

提交回复
热议问题