title: jQueryUI - uncaught exception: cannot call methods
body: <p>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:</p>
  
  <pre><code>uncaught exception: cannot call methods on dialog prior to initialization; attempted to call method 'open'
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>$(function() {
      $( "#dialog" ).dialog({
          autoOpen: false,
          show: "blind",
          hide: "explode"
      });
  
      $( "#opener" ).live('click',function() {
          $( "#dialog" ).dialog( "open" );
          return false;
      });
  });
  </code></pre>
  
  <p>I did some googling on the error and not much turned up, except that <code>jquery.ui.js</code> is generating the error with:</p>
  
  <pre><code>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 + "'";
          }
  ...
  </code></pre>
  
  <p>Any ideas? I appreciate any help on what this error message is and how to resolve it.</p>
  
  <p><strong>UPDATE:</strong> I tried commenting out the show/hide options and that did not have any effect on my problem. Below is the HTML:</p>
  
  <pre><code> &lt;div class="demo"&gt;
  
      &lt;div id="dialog" title="Basic dialog"&gt;
          &lt;p&gt;This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;button id="opener"&gt;Open Dialog&lt;/button&gt;
  
  &lt;/div&gt;&lt;!-- End demo --&gt;
  </code></pre>
  
  <p>This HTML is included in a PHP file, which is INCLUDED in another PHP file.</p>