When I click of a Button I'm using the following code for a function for a Dialog:

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");
}

However, when I inspect this in FireBug it is showing this error in the console:

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

modal: true

EDIT: There is another dialog also in the document that runs fine. when I comment out that one then this dialog then starts working. How do I change my code so they can work together in the same page?

Edit
Report