4

这是我的代码:

$("#success").dialog({
    modal: true,
    title: 'Payment success',
    width: 400,
});

如何OK在此对话框中显示按钮?

4

3 回答 3

15

使用Buttons 选项并查看Modal Message

$("#success").dialog({
  modal:true,
  title:'Payment success',
  width:400,
  buttons: {
    Ok: function() {
      $( this ).dialog( "close" );
    }
  }
});
于 2013-07-02T11:23:59.017 回答
2
$("#success").dialog({modal:true,title:'Payment success',width:400,buttons{"Ok":execute,"Cancel": cancel}});

var execute = function()
{
    alert('This is Ok button');
}

var cancel = function()
{
    alert('This is Cancel button');
}

那应该行得通。

于 2013-07-02T11:25:13.530 回答
1
$("#success").dialog({
modal:true,
title:'Payment success',
width:400,
buttons: {
        Ok: function() {
            $(this).dialog('close');
        }
});

这应该添加一个带有文本“确定”的按钮,当您单击该按钮时,对话框将关闭:)

http://jqueryui.com/dialog/

于 2013-07-02T11:26:55.757 回答