Search code examples
jquery-uijquery-ui-dialog

jQuery UI Dialog appendTo issue


I just update from jquery ui 1.11.4 to 1.12.1 and current code doesn't work

$('<div />').dialog();

I have to do this to show the dialog

$('<div />').appendTo('body').dialog();

I try to change appendTo default but doesn't work

$.extend($.ui.dialog.prototype.options, {
    position: {
        my: "top",
        at: "center top",
        of: window
    },
    classes: {
        "ui-dialog": "box-shadow display-inline-table"
    },
    appendTo: 'body',
    draggable: false,
    modal: true,
    resizable: false,
    width: 'auto',
    close: function(event, ui){
        $(this).remove();
    }
});

Any idea? I have to many dialogs in my app to change appendTo one by one.

Also have updated jquery to 3.1.1 from 2.1.4 and bootstrap to 3.3.7 from 3.3.5


Solution

  • I was also using jquery migrate plugin 1.2.1 and it cause conflict, removing this library solve the problem.