Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a "Type Error Dialog is not a Function" using jQuery UI?

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?

like image 904
HardCode Avatar asked May 15 '13 12:05

HardCode


Video Answer


2 Answers

This Occurred Because of two Jquery Files Being Included. So Watch out for you source code. This may help you get out of this stupid error.

like image 59
HardCode Avatar answered Sep 18 '22 13:09

HardCode


Also Check if Jquery Ui Script is loaded properly or not

like image 29
Srikanth Reddy Gandluri Avatar answered Sep 21 '22 13:09

Srikanth Reddy Gandluri