【问题标题】:how to pass the dialogue box buttons name as variable in jquery dialogue如何在jquery对话框中将对话框按钮名称作为变量传递
【发布时间】:2014-12-02 10:35:33
【问题描述】:

这里我想要对话框按钮值'yes','no'作为变量。我想将变量butt1传递给按钮。

 var button ='Yes'
 $("#modal_confirm_yes_no").dialog({
        bgiframe: true,
        autoOpen: false,
        minHeight: 200,
        width: 350,
        modal: true,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Yes': function(){
                    $(this).dialog('close');
                    callback(true);
                },
                'No': function(){
                    $(this).dialog('close');
                    callback(false);
                }
            }
    });

【问题讨论】:

  • 传递给按钮是什么意思?您想在单击按钮时访问/警告变量吗?
  • 'Yes','No' 按钮值应动态来自变量

标签: jquery jquery-ui jquery-ui-dialog


【解决方案1】:
 var button ='Yes'
 $("#modal_confirm_yes_no").dialog({
    bgiframe: true,
    autoOpen: false,
    minHeight: 200,
    width: 350,
    modal: true,
    closeOnEscape: false,
    draggable: false,
    resizable: false,
    buttons: [
        {text: button, click: function() {
            $(this).dialog('close');
            callback(true);
        }},
        {text: 'No', click: function() {
            $(this).dialog('close');
            callback(false);
        }}
    ]
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多