jQueryUI - uncaught exception: cannot call methods

Viewed 93939

I'm very new to jQuery and trying to run a pretty simple jQueryUI dialog box in my PHP application. In firebug console I get the error:

uncaught exception: cannot call methods on dialog prior to initialization; attempted to call method 'open'

Here is my code:

$(function() {
    $( "#dialog" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode"
    });

    $( "#opener" ).live('click',function() {
        $( "#dialog" ).dialog( "open" );
        return false;
    });
});

I did some googling on the error and not much turned up, except that jquery.ui.js is generating the error with:

if ( isMethodCall ) {
    this.each(function() {
        var instance = $.data( this, name );
        if ( !instance ) {
            throw "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'";
        }
...

Any ideas? I appreciate any help on what this error message is and how to resolve it.

UPDATE: I tried commenting out the show/hide options and that did not have any effect on my problem. Below is the HTML:

 <div class="demo">

    <div id="dialog" title="Basic dialog">
        <p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>

    <button id="opener">Open Dialog</button>

</div><!-- End demo -->

This HTML is included in a PHP file, which is INCLUDED in another PHP file.

5 Answers
Related