tags:

views:

39

answers:

3

Hi, I`m having the following error . Why am I having this error and how can I solve it?

$("SelectProject").dialog is not a function http://localhost:1419/Customer Line 57

$("#SelectProject").dialog is not a function http://localhost:1419/Customer Line 69

My codes are as follows:

$(document).ready(function() {

    $("#project_link").click(function() {
        $('SelectProject').dialog('open');
        return false;
    });

    $('#SelectProject').dialog({
        autoOpen: false,
        width: 800,
        position: [130, 200],
        buttons: {
            "Cancel": function() {
                $(this).dialog("close");
            },
            "Accept": function() {

                $(this).dialog("close");
            }
        }
    });
+1  A: 

Did you include the jQuery UI script file? "dialog()" is the jQuery UI method.

You can include this library like this:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"&gt;&lt;/script&gt;

This tag you need to put in the <head> section of you html document.

Sergey Kuznetsov
Also you may need to include some CSS files (with jQuery UI widgets styles). You may find out more information about this framework here: http://jqueryui.com/.
Sergey Kuznetsov
the error has disappeared with the script used. But still the dialog isn`t being displayed.
Did you include jQuery CSS-styles file? Without it you can't see dialogbox, because it will be transparent. Please, carefully read the jqueryui.com and their tutorials: http://jqueryui.com/demos/dialog/, http://jqueryui.com/docs/Getting_Started#Basic_overview:_using_jQuery_UI_on_a_web_page
Sergey Kuznetsov
A: 

Also, your selector in your click function looks wrong it should be:

$('#SelectProject').dialog('open');

(Assuming the element has an id of SelectProject)

James Westgate
A: 

I have the very same problem and I cannot find ANY solutions anywhere...

Here's my included files:

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/redmond/jquery-ui.css" />
    <script src="/Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"&gt;&lt;/script&gt;
    <script src="/Scripts/jQueryUI/jquery-ui-1.8.custom.min.js" type="text/javascript"></script>
    <script src="/Scripts/jQueryUI/jquery.ui.core.min.js" type="text/javascript"></script>
    <script src="/Scripts/jQueryUI/jquery.ui.draggable.min.js" type="text/javascript"></script>
    <script src="/Scripts/jQueryUI/jquery.ui.resizable.min.js" type="text/javascript"></script>
    <script src="/Scripts/jQueryUI/jquery.ui.dialog.min.js" type="text/javascript"></script>

I checked in Firebug to see if the files were loaded properly and they are there... I'm very stumped on this one!!

Stéphan Parrot