jQuery中对话框左侧的按钮

Button on Left side of Dialog Box in jQuery

本文关键字:按钮 对话框 jQuery      更新时间:2023-09-26

我使用jquery出现了一个对话框,如下所示:

$("#dialog").dialog({
        autoOpen: true,
        modal: true,
        title: "Group Invitation",
        width: 600,
        height: 300,
        resizable: false,
        buttons: {
            "Yes": function() {
                $(this).dialog("close");
                callback(true,myRowID);
            },
            "No": function() {
                $(this).dialog("close");
                callback(false,myRowID);
            }
                        }
    });

但我的问题是,如果我想在左边有一个按钮,因为这两个按钮都放在右边。请帮忙。

工作JSFIDDLE

 $('#dialog').dialog({
        autoOpen: true,
        height: 318,
        width: 531,
        modal: true,
        resize: false,
        buttons: {
            DelUser:{ 
                class: 'alignLeft',
                text: 'Delete User',
                click : function (){
                    alert('delete here');
                }
            },
            "Update User": function () {
                   alert('update here');
       },
            Close: function () {
                $(this).dialog("close");
            }
        }
    });

CSS:

 <style>
   .alignLeft
    {
     margin-right: 170px !important;
    }
 </style>

JSFIDDLE

您可以覆盖jquery ui按钮集类。

.ui-dialog-buttonset{
float:left !important;
}

Fiddle