为什么我使用jQuery UI获得"类型错误对话框不是函数"?

Har*_*ode 8 dialog jquery-ui

当我点击一个按钮时,我使用以下代码作为对话框的功能:

function Confirmation(msg1){
if ($('#exportSales').length == 0) {
        $(document.body).append('<div id="exportSales">'+msg1+'</div>');
    } else {
        $('#exportSales').html(msg1);
    }

    $("#exportSales").dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",        
        height: 450,
        width: 1000,
        modal: true
    });

    $( "#exportSales" ).dialog("open");
}
Run Code Online (Sandbox Code Playgroud)

但是,当我在FireBug中检查它时,它在控制台中显示此错误:

TypeError: $(...).dialog is not a function [Break On This Error]

modal: true
Run Code Online (Sandbox Code Playgroud)

编辑:文档中还有另一个对话框运行正常.当我注释掉那个时,然后这个对话框开始工作.如何更改我的代码以便它们可以在同一页面中一起工作?

Har*_*ode 17

由于包含两个 Jquery文件而发生这种情况.所以请注意你的源代码.这可以帮助您摆脱这个愚蠢的错误.