这里我希望对话框按钮值为'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);
}
}
});
答案 0 :(得分:3)
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);
}}
]
});