Add button to jquery ui dialog

后端 未结 4 1419
北恋
北恋 2020-12-14 19:42

I can not add button to this jquery ui dialog. if possible please give me an example . thanks.



        
4条回答
  •  生来不讨喜
    2020-12-14 20:15

    Here is an example

    add this to your function:

    buttons: {
                    OK: function() { //submit
                        $( this ).dialog( "close" );
                    },
                    Cancel: function() { //cancel
                        $( this ).dialog( "close" );
                    }
                }
    

    So you get

        $('#msgBox').dialog({
    
    
                    autoResize: true,
                    show: "clip",
                    hide: "clip",
                    height: 'auto',
                    width: 'auto',
                    autoOpen: false,
                    modal: true,
                    position: 'center',
                    draggable: false,
                    buttons: {
                    OK: function() { //ok
                        $( this ).dialog( "close" );
                    },
                    Cancel: function() { //cancel
                        $( this ).dialog( "close" );
                    }
                }
                    open: function (type, data) {
                        $(this).parent().appendTo("form");
                    }
    
    
                });
    

提交回复
热议问题